INT PAL 0053058: '2D Quadratic' item is shown in VTK context menu for non-quadratic mesh

This commit is contained in:
imn 2016-02-19 15:40:34 +03:00 committed by vsr
parent 04b68235aa
commit 7f46c31f2b
5 changed files with 26 additions and 5 deletions

View File

@ -4487,11 +4487,11 @@ void SMESHGUI::initialize( CAM_Application* app )
//-------------------------------------------------
anId = popupMgr()->insert( tr( "MEN_QUADRATIC_REPRESENT" ), -1, -1 );
popupMgr()->insert( action( SMESHOp::OpRepresentationLines ), anId, -1 );
popupMgr()->setRule( action( SMESHOp::OpRepresentationLines ), aMeshInVTK + "and isVisible",QtxPopupMgr::VisibleRule );
popupMgr()->setRule( action( SMESHOp::OpRepresentationLines ), aMeshInVTK + "&& isVisible && isQuadratic",QtxPopupMgr::VisibleRule );
popupMgr()->setRule( action( SMESHOp::OpRepresentationLines ), "quadratic2DMode = 'eLines'", QtxPopupMgr::ToggleRule );
popupMgr()->insert( action( SMESHOp::OpRepresentationArcs ), anId, -1 );
popupMgr()->setRule( action( SMESHOp::OpRepresentationArcs ), aMeshInVTK + "and isVisible", QtxPopupMgr::VisibleRule );
popupMgr()->setRule( action( SMESHOp::OpRepresentationArcs ), aMeshInVTK + "&& isVisible && isQuadratic", QtxPopupMgr::VisibleRule );
popupMgr()->setRule( action( SMESHOp::OpRepresentationArcs ), "quadratic2DMode = 'eArcs'", QtxPopupMgr::ToggleRule );
//-------------------------------------------------

View File

@ -326,7 +326,7 @@ void SMESHGUI_ConvToQuadOp::onWarningWinFinished()
SMESHGUI_ConvToQuadOp::MeshDestinationType
SMESHGUI_ConvToQuadOp::DestinationMesh( const SMESH::SMESH_IDSource_var& idSource,
bool* isMixOrder) const
bool* isMixOrder)
{
SMESH::long_array_var nbElemOfType = idSource->GetMeshInfo();

View File

@ -52,12 +52,12 @@ public:
virtual LightApp_Dialog* dlg() const;
static MeshDestinationType DestinationMesh( const SMESH::SMESH_IDSource_var& ,
bool* isMixOrder = 0);
protected:
virtual void startOperation();
virtual void selectionDone();
virtual SUIT_SelectionFilter* createFilter( const int ) const;
MeshDestinationType DestinationMesh( const SMESH::SMESH_IDSource_var& ,
bool* isMixOrder = 0) const;
protected slots:
virtual bool onApply();

View File

@ -32,6 +32,7 @@
#include "SMESHGUI_VTKUtils.h"
#include "SMESHGUI_GEOMGenUtils.h"
#include "SMESHGUI_ComputeDlg.h"
#include "SMESHGUI_ConvToQuadOp.h"
#include <SMESH_Type.h>
#include <SMESH_Actor.h>
@ -133,6 +134,7 @@ QVariant SMESHGUI_Selection::parameter( const int ind, const QString& p ) const
else if ( p=="isImported" ) val = QVariant( isImported( ind ) );
else if ( p=="facesOrientationMode" ) val = QVariant( facesOrientationMode( ind ) );
else if ( p=="groupType" ) val = QVariant( groupType( ind ) );
else if ( p=="isQuadratic" ) val = QVariant( isQuadratic( ind ) );
else if ( p=="quadratic2DMode") val = QVariant( quadratic2DMode( ind ) );
else if ( p=="isDistributionVisible") val = QVariant( isDistributionVisible( ind ) );
else if ( p=="isScalarBarVisible") val = QVariant( isScalarBarVisible( ind ) );
@ -231,6 +233,24 @@ QString SMESHGUI_Selection::displayMode( int ind ) const
return "Unknown";
}
//=======================================================================
//function : isQuadratic
//purpose : return true if the mesh has quadratic/bi-quadratic type
//=======================================================================
bool SMESHGUI_Selection::isQuadratic( int ind ) const
{
_PTR(SObject) so = SMESH::GetActiveStudyDocument()->FindObjectID( entry( ind ).toLatin1().data() );
if ( !so )
return false;
SMESH::SMESH_IDSource_var idSource = SMESH::SObjectToInterface<SMESH::SMESH_IDSource>( so );
if ( idSource->_is_nil() )
return false;
SMESHGUI_ConvToQuadOp::MeshDestinationType meshTgtType = SMESHGUI_ConvToQuadOp::DestinationMesh( idSource );
if ( meshTgtType & SMESHGUI_ConvToQuadOp::MeshDestinationType::Linear )
return true;
return false;
}
//=======================================================================
//function : quadratic2DMode

View File

@ -62,6 +62,7 @@ public:
virtual bool isEditableHyp( int ) const;
virtual bool isVisible( int ) const;
virtual bool isQuadratic( int ) const;
virtual QString quadratic2DMode( int ) const;
virtual bool isDistributionVisible( int ) const;