X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=blobdiff_plain;f=src%2FSMESHGUI%2FSMESHGUI_ConvToQuadOp.cxx;fp=src%2FSMESHGUI%2FSMESHGUI_ConvToQuadOp.cxx;h=a5575b8797bae2cfc2667da3d4755df98ca9817e;hp=a62d0b94993be4b23b7dcdf7e644cf7d431b31ec;hb=f5016d85b7b4b88623723027a1585c6414c4dc66;hpb=e4f02cdb389c8e4170ac26760a3f0257a009fd3b diff --git a/src/SMESHGUI/SMESHGUI_ConvToQuadOp.cxx b/src/SMESHGUI/SMESHGUI_ConvToQuadOp.cxx index a62d0b949..a5575b879 100644 --- a/src/SMESHGUI/SMESHGUI_ConvToQuadOp.cxx +++ b/src/SMESHGUI/SMESHGUI_ConvToQuadOp.cxx @@ -29,21 +29,26 @@ #include "SMESHGUI.h" #include "SMESHGUI_ConvToQuadDlg.h" +#include "SMESHGUI_MeshEditPreview.h" #include "SMESHGUI_Utils.h" -#include "SMDSAbs_ElementType.hxx" - +#include "SMESH_ActorUtils.h" #include "SMESH_TypeFilter.hxx" +#include "SMDSAbs_ElementType.hxx" // SALOME GUI includes #include #include #include #include +#include // IDL includes #include #include CORBA_SERVER_HEADER(SMESH_MeshEditor) +// VTK includes +#include + //================================================================================ /*! * \brief Constructor @@ -53,7 +58,8 @@ //================================================================================ SMESHGUI_ConvToQuadOp::SMESHGUI_ConvToQuadOp() : SMESHGUI_SelectionOp(), - myDlg( 0 ) + myDlg( 0 ), + myBadElemsPreview(0) { } @@ -64,8 +70,8 @@ SMESHGUI_ConvToQuadOp::SMESHGUI_ConvToQuadOp() //================================================================================ SMESHGUI_ConvToQuadOp::~SMESHGUI_ConvToQuadOp() { - if ( myDlg ) - delete myDlg; + if ( myDlg ) delete myDlg; + if ( myBadElemsPreview ) delete myBadElemsPreview; } //================================================================================ @@ -237,14 +243,47 @@ bool SMESHGUI_ConvToQuadOp::onApply() SMESH::SMESH_Mesh_var sourceMesh = SMESH::SObjectToInterface( pObj ); if( !myDlg->CurrentRB() ) { - bool aParam = true; + bool force3d = true; if( myDlg->IsEnabledCheck() ) - aParam = myDlg->IsMediumNdsOnGeom(); + force3d = myDlg->IsMediumNdsOnGeom(); if ( sourceMesh->_is_nil() ) - aEditor->ConvertToQuadraticObject( aParam, idSource ); + aEditor->ConvertToQuadraticObject( force3d, idSource ); else - aEditor->ConvertToQuadratic( aParam ); + aEditor->ConvertToQuadratic( force3d ); + + if ( !force3d ) + { + SMESH::ComputeError_var error = aEditor->GetLastError(); + if ( error->hasBadMesh ) + { + if ( myBadElemsPreview ) delete myBadElemsPreview; // viewWindow may change + myBadElemsPreview = new SMESHGUI_MeshEditPreview( viewWindow() ); + + vtkFloatingPointType aPointSize = SMESH::GetFloat("SMESH:node_size",3); + vtkFloatingPointType aLineWidth = SMESH::GetFloat("SMESH:element_width",1); + vtkProperty* prop = vtkProperty::New(); + prop->SetLineWidth( aLineWidth * 3 ); + prop->SetPointSize( aPointSize * 3 ); + prop->SetColor( 250, 0, 250 ); + myBadElemsPreview->GetActor()->SetProperty( prop ); + prop->Delete(); + + SMESH::MeshPreviewStruct_var previewData = aEditor->GetPreviewData(); + myBadElemsPreview->SetData( & previewData.in() ); + myBadElemsPreview->SetVisibility(true); + + SUIT_MessageBox* mb = new SUIT_MessageBox(SUIT_MessageBox::Warning, + tr( "SMESH_WRN_WARNING" ), + tr("EDITERR_NO_MEDIUM_ON_GEOM"), + SUIT_MessageBox::Ok, myDlg); + mb->setWindowModality( Qt::NonModal ); + mb->setAttribute( Qt::WA_DeleteOnClose ); + mb->show(); + connect ( mb, SIGNAL( finished(int) ), this, SLOT( onWarningWinFinished() )); + //connect ( mb, SIGNAL( rejected() ), this, SLOT( onWarningWinFinished() )); + } + } } else { @@ -272,6 +311,18 @@ bool SMESHGUI_ConvToQuadOp::onApply() return aResult; } +//================================================================================ +/*! + * \brief SLOT called when a warning window is closed + */ +//================================================================================ + +void SMESHGUI_ConvToQuadOp::onWarningWinFinished() +{ + if ( myBadElemsPreview ) + myBadElemsPreview->SetVisibility(false); +} + //================================================================================ /*! ConsistMesh * Determines, what elements this mesh contains.