New mesh icon if geometry changes

This commit is contained in:
eap 2020-01-28 17:14:39 +03:00
parent c4d4c3be32
commit ab494e654a
8 changed files with 197 additions and 3 deletions

View File

@ -114,6 +114,7 @@ SET(SMESH_RESOURCES_FILES
mesh_tree_mesh.png
mesh_tree_importedmesh.png
mesh_tree_mesh_warn.png
mesh_tree_mesh_geom_modif.png
mesh_triangle_n.png
mesh_triquad_hexahedron.png
mesh_triangle.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 307 B

View File

@ -1436,6 +1436,55 @@ namespace
}
}
//================================================================================
/*!
* \brief Return true if a mesh icon == ICON_SMESH_TREE_GEOM_MODIF
* which means that the mesh can't be modified. It should be either re-computed
* or breakShaperLink()'ed. Warn the user about it.
*/
//================================================================================
bool warnOnGeomModif()
{
SALOME_ListIO selected;
if ( LightApp_SelectionMgr *aSel = SMESHGUI::selectionMgr() )
aSel->selectedObjects(selected,"",/*convertReferences=*/false);
SALOME_ListIteratorOfListIO It( selected );
for ( ; It.More(); It.Next() )
{
Handle(SALOME_InteractiveObject) io = It.Value();
if ( !io->hasEntry() ) continue;
_PTR(SObject) so = SMESH::getStudy()->FindObjectID( io->getEntry() );
SMESH::SMESH_Mesh_var mesh;
while ( mesh->_is_nil() && so )
{
CORBA::Object_var obj = SMESH::SObjectToObject( so );
SMESH::SMESH_IDSource_var isrc = SMESH::SMESH_IDSource::_narrow( obj );
if ( isrc->_is_nil() )
so = so->GetFather();
else
mesh = isrc->GetMesh();
}
if ( mesh->_is_nil() ) continue;
so = SMESH::FindSObject( mesh );
if ( !so ) continue;
_PTR(GenericAttribute) attr;
so->FindAttribute( attr, "AttributePixMap" );
_PTR(AttributePixMap) pixmap = attr;
if ( !pixmap ) continue;
if ( pixmap->GetPixMap() == "ICON_SMESH_TREE_GEOM_MODIF" )
{
SUIT_MessageBox::warning(SMESHGUI::desktop(),
QObject::tr("SMESH_WRN_WARNING"),
QObject::tr("MSG_WARN_ON_GEOM_MODIF"));
return true;
}
}
return false;
}
void SetDisplayMode(int theCommandID, VTK::MarkerMap& theMarkerMap)
{
SALOME_ListIO selected;
@ -2808,16 +2857,19 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
break;
}
case SMESHOp::OpCreateMesh:
case SMESHOp::OpCreateSubMesh:
case SMESHOp::OpEditMeshOrSubMesh:
case SMESHOp::OpEditMesh:
case SMESHOp::OpEditSubMesh:
case SMESHOp::OpMeshOrder:
case SMESHOp::OpCreateSubMesh:
if ( warnOnGeomModif() )
break; // action forbiden as geometry modified
case SMESHOp::OpCreateMesh:
case SMESHOp::OpCompute:
case SMESHOp::OpComputeSubMesh:
case SMESHOp::OpPreCompute:
case SMESHOp::OpEvaluate:
case SMESHOp::OpMeshOrder:
startOperation( theCommandID );
break;
case SMESHOp::OpCopyMesh:
@ -2846,6 +2898,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
if ( isStudyLocked() )
break;
if ( warnOnGeomModif() )
break; // action forbiden as geometry modified
/*Standard_Boolean aRes;
SMESH::SMESH_Mesh_var aMesh = SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(IObject);
@ -2876,6 +2930,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
if ( isStudyLocked() )
break;
if ( warnOnGeomModif() )
break; // action forbiden as geometry modified
EmitSignalDeactivateDialog();
SMESHGUI_MultiEditDlg* aDlg = NULL;
@ -2894,6 +2950,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
case SMESHOp::OpSmoothing:
{
if(isStudyLocked()) break;
if ( warnOnGeomModif() )
break; // action forbiden as geometry modified
if( vtkwnd ) {
EmitSignalDeactivateDialog();
( new SMESHGUI_SmoothingDlg( this ) )->show();
@ -2906,6 +2964,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
case SMESHOp::OpExtrusion:
{
if (isStudyLocked()) break;
if ( warnOnGeomModif() )
break; // action forbiden as geometry modified
if (vtkwnd) {
EmitSignalDeactivateDialog();
( new SMESHGUI_ExtrusionDlg ( this ) )->show();
@ -2917,6 +2977,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
case SMESHOp::OpExtrusionAlongAPath:
{
if (isStudyLocked()) break;
if ( warnOnGeomModif() )
break; // action forbiden as geometry modified
if (vtkwnd) {
EmitSignalDeactivateDialog();
( new SMESHGUI_ExtrusionAlongPathDlg( this ) )->show();
@ -2928,6 +2990,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
case SMESHOp::OpRevolution:
{
if(isStudyLocked()) break;
if ( warnOnGeomModif() )
break; // action forbiden as geometry modified
if( vtkwnd ) {
EmitSignalDeactivateDialog();
( new SMESHGUI_RevolutionDlg( this ) )->show();
@ -2941,6 +3005,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
{
if ( isStudyLocked() )
break;
if ( warnOnGeomModif() )
break; // action forbiden as geometry modified
if ( vtkwnd )
{
EmitSignalDeactivateDialog();
@ -2957,6 +3023,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
case SMESHOp::OpReorientFaces:
case SMESHOp::OpCreateGeometryGroup:
{
if ( warnOnGeomModif() )
break; // action forbiden as geometry modified
startOperation( theCommandID );
break;
}
@ -2969,6 +3037,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
}
if(isStudyLocked()) break;
if ( warnOnGeomModif() )
break; // action forbiden as geometry modified
EmitSignalDeactivateDialog();
SMESH::SMESH_Mesh_var aMesh = SMESH::SMESH_Mesh::_nil();
@ -2996,6 +3066,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
}
if(isStudyLocked()) break;
if ( warnOnGeomModif() )
break; // action forbiden as geometry modified
EmitSignalDeactivateDialog();
LightApp_SelectionMgr *aSel = SMESHGUI::selectionMgr();
@ -3073,6 +3145,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
}
if(isStudyLocked()) break;
if ( warnOnGeomModif() )
break; // action forbiden as geometry modified
EmitSignalDeactivateDialog();
LightApp_SelectionMgr *aSel = SMESHGUI::selectionMgr();
@ -3170,6 +3244,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
if ( isStudyLocked() )
break;
if ( warnOnGeomModif() )
break; // action forbiden as geometry modified
EmitSignalDeactivateDialog();
@ -3190,6 +3266,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
{
if ( isStudyLocked() )
break;
if ( warnOnGeomModif() )
break; // action forbiden as geometry modified
EmitSignalDeactivateDialog();
SMESHGUI_GroupOpDlg* aDlg = new SMESHGUI_DimGroupDlg( this );
@ -3202,6 +3280,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
{
if ( isStudyLocked() )
break;
if ( warnOnGeomModif() )
break; // action forbiden as geometry modified
EmitSignalDeactivateDialog();
SMESHGUI_FaceGroupsSeparatedByEdgesDlg* aDlg = new SMESHGUI_FaceGroupsSeparatedByEdgesDlg( this );
@ -3261,6 +3341,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
case SMESHOp::OpEditHypothesis:
{
if(isStudyLocked()) break;
if ( warnOnGeomModif() )
break; // action forbiden as geometry modified
LightApp_SelectionMgr *aSel = SMESHGUI::selectionMgr();
SALOME_ListIO selected;
@ -3306,6 +3388,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
case SMESHOp::OpUnassign: // REMOVE HYPOTHESIS / ALGORITHMS
{
if(isStudyLocked()) break;
if ( warnOnGeomModif() )
break; // action forbiden as geometry modified
SUIT_OverrideCursor wc;
LightApp_SelectionMgr *aSel = SMESHGUI::selectionMgr();
@ -3337,6 +3421,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
case SMESHOp::OpHexagonalPrism:
{
if(isStudyLocked()) break;
if ( warnOnGeomModif() )
break; // action forbiden as geometry modified
if ( vtkwnd ) {
EmitSignalDeactivateDialog();
SMDSAbs_EntityType type = SMDSEntity_Edge;
@ -3363,6 +3449,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
case SMESHOp::OpPolyhedron:
{
if(isStudyLocked()) break;
if ( warnOnGeomModif() )
break; // action forbiden as geometry modified
if ( vtkwnd ) {
EmitSignalDeactivateDialog();
( new SMESHGUI_CreatePolyhedralVolumeDlg( this ) )->show();
@ -3386,6 +3474,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
case SMESHOp::OpTriQuadraticHexahedron:
{
if(isStudyLocked()) break;
if ( warnOnGeomModif() )
break; // action forbiden as geometry modified
if ( vtkwnd ) {
EmitSignalDeactivateDialog();
SMDSAbs_EntityType type = SMDSEntity_Last;
@ -3417,6 +3507,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
case SMESHOp::OpRemoveNodes:
{
if(isStudyLocked()) break;
if ( warnOnGeomModif() )
break; // action forbiden as geometry modified
if ( vtkwnd ) {
EmitSignalDeactivateDialog();
( new SMESHGUI_RemoveNodesDlg( this ) )->show();
@ -3430,6 +3522,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
case SMESHOp::OpRemoveElements: // REMOVES ELEMENTS
{
if(isStudyLocked()) break;
if ( warnOnGeomModif() )
break; // action forbiden as geometry modified
if( vtkwnd ) {
EmitSignalDeactivateDialog();
( new SMESHGUI_RemoveElementsDlg( this ) )->show();
@ -3444,6 +3538,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
case SMESHOp::OpClearMesh: {
if(isStudyLocked()) break;
if ( warnOnGeomModif() )
break; // action forbiden as geometry modified
SALOME_ListIO selected;
if( LightApp_SelectionMgr *aSel = SMESHGUI::selectionMgr() )
@ -3483,6 +3579,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
case SMESHOp::OpRemoveOrphanNodes:
{
if(isStudyLocked()) break;
if ( warnOnGeomModif() )
break; // action forbiden as geometry modified
SALOME_ListIO selected;
if( LightApp_SelectionMgr *aSel = SMESHGUI::selectionMgr() )
aSel->selectedObjects( selected );
@ -3522,6 +3620,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
case SMESHOp::OpRenumberingNodes:
{
if(isStudyLocked()) break;
if ( warnOnGeomModif() )
break; // action forbiden as geometry modified
if( vtkwnd ) {
EmitSignalDeactivateDialog();
( new SMESHGUI_RenumberingDlg( this, 0 ) )->show();
@ -3536,6 +3636,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
case SMESHOp::OpRenumberingElements:
{
if(isStudyLocked()) break;
if ( warnOnGeomModif() )
break; // action forbiden as geometry modified
if ( vtkwnd ) {
EmitSignalDeactivateDialog();
( new SMESHGUI_RenumberingDlg( this, 1 ) )->show();
@ -3550,6 +3652,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
case SMESHOp::OpTranslation:
{
if(isStudyLocked()) break;
if ( warnOnGeomModif() )
break; // action forbiden as geometry modified
if ( vtkwnd ) {
EmitSignalDeactivateDialog();
( new SMESHGUI_TranslationDlg( this ) )->show();
@ -3563,6 +3667,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
case SMESHOp::OpRotation:
{
if(isStudyLocked()) break;
if ( warnOnGeomModif() )
break; // action forbiden as geometry modified
if( vtkwnd ) {
EmitSignalDeactivateDialog();
( new SMESHGUI_RotationDlg( this ) )->show();
@ -3576,6 +3682,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
case SMESHOp::OpSymmetry:
{
if(isStudyLocked()) break;
if ( warnOnGeomModif() )
break; // action forbiden as geometry modified
if(vtkwnd) {
EmitSignalDeactivateDialog();
( new SMESHGUI_SymmetryDlg( this ) )->show();
@ -3589,6 +3697,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
case SMESHOp::OpScale:
{
if(isStudyLocked()) break;
if ( warnOnGeomModif() )
break; // action forbiden as geometry modified
if ( vtkwnd ) {
EmitSignalDeactivateDialog();
( new SMESHGUI_ScaleDlg( this ) )->show();
@ -3603,6 +3713,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
case SMESHOp::OpOffset:
{
if(isStudyLocked()) break;
if ( warnOnGeomModif() )
break; // action forbiden as geometry modified
if ( vtkwnd ) {
EmitSignalDeactivateDialog();
( new SMESHGUI_OffsetDlg( this ) )->show();
@ -3617,6 +3729,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
case SMESHOp::OpSewing:
{
if(isStudyLocked()) break;
if ( warnOnGeomModif() )
break; // action forbiden as geometry modified
if(vtkwnd) {
EmitSignalDeactivateDialog();
( new SMESHGUI_SewingDlg( this ) )->show();
@ -3630,6 +3744,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
case SMESHOp::OpMergeNodes:
{
if(isStudyLocked()) break;
if ( warnOnGeomModif() )
break; // action forbiden as geometry modified
if(vtkwnd) {
EmitSignalDeactivateDialog();
( new SMESHGUI_MergeDlg( this, 0 ) )->show();
@ -3643,6 +3759,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
case SMESHOp::OpMergeElements:
{
if (isStudyLocked()) break;
if ( warnOnGeomModif() )
break; // action forbiden as geometry modified
if (vtkwnd) {
EmitSignalDeactivateDialog();
( new SMESHGUI_MergeDlg( this, 1 ) )->show();
@ -3654,12 +3772,16 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
}
case SMESHOp::OpMoveNode: // MAKE MESH PASS THROUGH POINT
if ( warnOnGeomModif() )
break; // action forbiden as geometry modified
startOperation( SMESHOp::OpMoveNode );
break;
case SMESHOp::OpDuplicateNodes:
{
if(isStudyLocked()) break;
if ( warnOnGeomModif() )
break; // action forbiden as geometry modified
if ( vtkwnd ) {
EmitSignalDeactivateDialog();
( new SMESHGUI_DuplicateNodesDlg( this ) )->show();
@ -3672,6 +3794,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
}
case SMESHOp::OpElem0DOnElemNodes: // 0D_ON_ALL_NODES
if ( warnOnGeomModif() )
break; // action forbiden as geometry modified
startOperation( SMESHOp::OpElem0DOnElemNodes );
break;

View File

@ -531,6 +531,10 @@
<source>ICON_SMESH_TREE_MESH_WARN</source>
<translation>mesh_tree_mesh_warn.png</translation>
</message>
<message>
<source>ICON_SMESH_TREE_GEOM_MODIF</source>
<translation>mesh_tree_mesh_geom_modif.png</translation>
</message>
<message>
<source>ICON_STD_INFO</source>
<translation>standard_mesh_info.png</translation>

View File

@ -4515,6 +4515,11 @@ It can&apos;t be deleted </translation>
<source>MSG_BREAK_SHAPER_LINK</source>
<translation>A link with Shaper model for object %1 will be broken.
Continue?</translation>
</message>
<message>
<source>MSG_WARN_ON_GEOM_MODIF</source>
<translation>This action is prohibited since the geometry
was changed and the mesh needs to be recomputed.</translation>
</message>
<message>
<source>SMESH_ADVANCED</source>

View File

@ -731,6 +731,53 @@ void SMESH_Gen_i::UpdateStudy()
}
}
//=================================================================================
// function : hasObjectInfo()
// purpose : shows if module provides information for its objects
//=================================================================================
bool SMESH_Gen_i::hasObjectInfo()
{
return true;
}
//=================================================================================
// function : getObjectInfo()
// purpose : returns an information for a given object by its entry
//=================================================================================
char* SMESH_Gen_i::getObjectInfo( const char* entry )
{
// for a mesh with icon == ICON_SMESH_TREE_GEOM_MODIF show a warning;
// for the rest, "module 'SMESH', ID=0:1:2:*"
SMESH_Comment txt;
SALOMEDS::SObject_wrap so = getStudyServant()->FindObjectID( entry );
CORBA::Object_var obj = SObjectToObject( so );
SMESH::SMESH_Mesh_var mesh = SMESH::SMESH_Mesh::_narrow( obj );
if ( !mesh->_is_nil() )
{
SALOMEDS::GenericAttribute_wrap attr;
if ( so->FindAttribute( attr.inout(), "AttributePixMap" ))
{
SALOMEDS::AttributePixMap_wrap pm = attr;
CORBA::String_var ico = pm->GetPixMap();
if ( strcmp( ico.in(), "ICON_SMESH_TREE_GEOM_MODIF" ) == 0 )
{
txt << "The geometry was changed and the mesh needs to be recomputed";
}
}
}
if ( txt.empty() )
{
CORBA::String_var compType = ComponentDataType();
txt << "module '" << compType << "', ID=" << entry;
}
return CORBA::string_dup( txt );
}
//=============================================================================
/*!
* SMESH_Gen_i::GetStudyContext

View File

@ -159,6 +159,12 @@ public:
// Update study
void UpdateStudy();
// Do provide info on objects
bool hasObjectInfo();
// Return an information for a given object
char* getObjectInfo(const char* entry);
// Create hypothesis/algorithm of given type
SMESH::SMESH_Hypothesis_ptr CreateHypothesis (const char* theHypType,
const char* theLibName)

View File

@ -2470,6 +2470,13 @@ void SMESH_Mesh_i::CheckGeomModif( bool isBreakLink )
}
_gen_i->UpdateIcons( SMESH::SMESH_Mesh_var( _this() ));
if ( !isBreakLink )
{
SALOMEDS::SObject_wrap meshSO = _gen_i->ObjectToSObject( me );
if ( !meshSO->_is_nil() )
_gen_i->SetPixMap(meshSO, "ICON_SMESH_TREE_GEOM_MODIF");
}
}
//=============================================================================