From 1b80c8bc605eaea62874a92d75613657bf664e9e Mon Sep 17 00:00:00 2001 From: eap Date: Tue, 10 Jul 2018 17:41:10 +0300 Subject: [PATCH] Restore change of mesh icon depending on its status now icons are updated on the engine side + Remove deprecated smesh.py --- src/SMESH/SMESH_Mesh.cxx | 35 ++++ src/SMESH/SMESH_Mesh.hxx | 5 + src/SMESH/SMESH_subMesh.hxx | 2 +- src/SMESHGUI/SMESHGUI.cxx | 5 - src/SMESHGUI/SMESHGUI_ComputeDlg.cxx | 4 - src/SMESHGUI/SMESHGUI_Hypotheses.cxx | 1 - src/SMESHGUI/SMESHGUI_HypothesesUtils.cxx | 14 -- src/SMESHGUI/SMESHGUI_MeshOrderOp.cxx | 9 +- src/SMESHGUI/SMESHGUI_Utils.cxx | 77 -------- src/SMESHGUI/SMESHGUI_Utils.h | 3 - src/SMESH_I/SMESH_Gen_i.cxx | 1 + src/SMESH_I/SMESH_Gen_i.hxx | 55 +----- src/SMESH_I/SMESH_Gen_i_1.cxx | 163 +++++++++++++++- src/SMESH_I/SMESH_Mesh_i.cxx | 22 +++ src/SMESH_I/SMESH_Mesh_i.hxx | 22 ++- src/SMESH_I/SMESH_PythonDump.cxx | 1 - src/SMESH_SWIG/CMakeLists.txt | 1 - src/SMESH_SWIG/smesh.py | 122 ------------ src/SMESH_SWIG/smeshBuilder.py | 12 -- src/SMESH_SWIG_WITHIHM/libSMESH_Swig.cxx | 214 +++++++++++----------- 20 files changed, 362 insertions(+), 406 deletions(-) delete mode 100644 src/SMESH_SWIG/smesh.py diff --git a/src/SMESH/SMESH_Mesh.cxx b/src/SMESH/SMESH_Mesh.cxx index b9b510451..afefed35a 100644 --- a/src/SMESH/SMESH_Mesh.cxx +++ b/src/SMESH/SMESH_Mesh.cxx @@ -1336,6 +1336,41 @@ bool SMESH_Mesh::HasModificationsToDiscard() const return false; } +//============================================================================= +/*! + * \brief Return true if all sub-meshes are computed OK - to update an icon + */ +//============================================================================= + +bool SMESH_Mesh::IsComputedOK() +{ + if ( NbNodes() == 0 ) + return false; + + if ( !HasShapeToMesh() ) + return true; + + if ( SMESH_subMesh* mainSM = GetSubMeshContaining( 1 )) + { + SMESH_subMeshIteratorPtr smIt = mainSM->getDependsOnIterator(/*includeSelf=*/true); + while ( smIt->more() ) + { + const SMESH_subMesh* sm = smIt->next(); + if ( !sm->IsAlwaysComputed() ) + switch ( sm->GetComputeState() ) + { + case SMESH_subMesh::NOT_READY: + case SMESH_subMesh::COMPUTE_OK: + continue; // ok + case SMESH_subMesh::FAILED_TO_COMPUTE: + case SMESH_subMesh::READY_TO_COMPUTE: + return false; + } + } + } + return true; +} + //================================================================================ /*! * \brief Check if any groups of the same type have equal names diff --git a/src/SMESH/SMESH_Mesh.hxx b/src/SMESH/SMESH_Mesh.hxx index 78681c396..57c26d63a 100644 --- a/src/SMESH/SMESH_Mesh.hxx +++ b/src/SMESH/SMESH_Mesh.hxx @@ -235,6 +235,11 @@ class SMESH_EXPORT SMESH_Mesh */ bool HasModificationsToDiscard() const; + /*! + * \brief Return true if all sub-meshes are computed OK - to update an icon + */ + bool IsComputedOK(); + /*! * \brief Return data map of descendant to ancestor shapes */ diff --git a/src/SMESH/SMESH_subMesh.hxx b/src/SMESH/SMESH_subMesh.hxx index 3d2697241..9db6348cd 100644 --- a/src/SMESH/SMESH_subMesh.hxx +++ b/src/SMESH/SMESH_subMesh.hxx @@ -261,7 +261,7 @@ public: * none mesh entity is bound to it */ void SetIsAlwaysComputed(bool isAlCo); - bool IsAlwaysComputed() { return _alwaysComputed; } + bool IsAlwaysComputed() const { return _alwaysComputed; } bool SubMeshesComputed(bool * isFailedToCompute=0) const; diff --git a/src/SMESHGUI/SMESHGUI.cxx b/src/SMESHGUI/SMESHGUI.cxx index 2956e818f..82aaf6581 100644 --- a/src/SMESHGUI/SMESHGUI.cxx +++ b/src/SMESHGUI/SMESHGUI.cxx @@ -1942,10 +1942,6 @@ void SMESHGUI::OnEditDelete() else if ( !aSubMesh->_is_nil() ) { // DELETE SUBMESH SMESH::SMESH_Mesh_var aMesh = aSubMesh->GetFather(); aMesh->RemoveSubMesh( aSubMesh ); - - _PTR(SObject) aMeshSO = SMESH::FindSObject(aMesh); - if (aMeshSO) - SMESH::ModifiedMesh(aMeshSO, false, aMesh->NbNodes()==0); } else { Handle(SALOME_InteractiveObject) IObject = new SALOME_InteractiveObject @@ -3331,7 +3327,6 @@ bool SMESHGUI::OnGUIEvent( int theCommandID ) if ( aMesh->NbNodes() == 0 ) // imported mesh is not empty SMESH::RemoveVisualObjectWithActors(IOS->getEntry(), true); _PTR(SObject) aMeshSObj = SMESH::FindSObject(aMesh); - SMESH::ModifiedMesh( aMeshSObj, false, true); // hide groups and submeshes _PTR(ChildIterator) anIter = SMESH::getStudy()->NewChildIterator( aMeshSObj ); diff --git a/src/SMESHGUI/SMESHGUI_ComputeDlg.cxx b/src/SMESHGUI/SMESHGUI_ComputeDlg.cxx index e4b23363e..377092083 100644 --- a/src/SMESHGUI/SMESHGUI_ComputeDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_ComputeDlg.cxx @@ -925,10 +925,6 @@ void SMESHGUI_BaseComputeOp::computeMesh() // NPAL16631: if ( !memoryLack ) { - _PTR(SObject) sobj = SMESH::getStudy()->FindObjectID(myIObject->getEntry()); - SMESH::ModifiedMesh( sobj, - !computeFailed && aHypErrors.isEmpty(), - myMesh->NbNodes() == 0); update( UF_ObjBrowser | UF_Model ); // SHOW MESH diff --git a/src/SMESHGUI/SMESHGUI_Hypotheses.cxx b/src/SMESHGUI/SMESHGUI_Hypotheses.cxx index b00ac68d7..257cb657c 100644 --- a/src/SMESHGUI/SMESHGUI_Hypotheses.cxx +++ b/src/SMESHGUI/SMESHGUI_Hypotheses.cxx @@ -317,7 +317,6 @@ void SMESHGUI_GenericHypothesisCreator::onDialogFinished( int result ) if( !aSubMesh->_is_nil() ) aMesh = aSubMesh->GetFather(); _PTR(SObject) meshSO = SMESH::FindSObject( aMesh ); - SMESH::ModifiedMesh( meshSO, false, aMesh->NbNodes()==0); SMESH_Actor* actor = SMESH::FindActorByEntry( meshSO->GetID().c_str() ); if( actor && actor->GetVisibility() ) actor->Update(); diff --git a/src/SMESHGUI/SMESHGUI_HypothesesUtils.cxx b/src/SMESHGUI/SMESHGUI_HypothesesUtils.cxx index 2ca363488..3ddfb47dc 100644 --- a/src/SMESHGUI/SMESHGUI_HypothesesUtils.cxx +++ b/src/SMESHGUI/SMESHGUI_HypothesesUtils.cxx @@ -631,12 +631,6 @@ namespace SMESH try { CORBA::String_var error; res = aMesh->AddHypothesis(aShapeObject, aHyp, error.out()); - if (res < SMESH::HYP_UNKNOWN_FATAL) { - _PTR(SObject) aSH = SMESH::FindSObject(aHyp); - if (SM && aSH) { - SMESH::ModifiedMesh(SM, false, aMesh->NbNodes()==0); - } - } if (res > SMESH::HYP_OK) { wc.suspend(); processHypothesisStatus(res, aHyp, true, error.in() ); @@ -668,11 +662,6 @@ namespace SMESH { CORBA::String_var error; res = aMesh->AddHypothesis( aShapeObject, aHyp, error.out() ); - if (res < SMESH::HYP_UNKNOWN_FATAL) { - _PTR(SObject) meshSO = SMESH::FindSObject(aMesh); - if (meshSO) - SMESH::ModifiedMesh(meshSO, false, aMesh->NbNodes()==0); - } if (res > SMESH::HYP_OK) { wc.suspend(); processHypothesisStatus( res, aHyp, true, error.in() ); @@ -763,9 +752,6 @@ namespace SMESH } if ( _PTR(SObject) meshSO = SMESH::FindSObject(aMesh) ) { - if ( res < SMESH::HYP_UNKNOWN_FATAL ) - SMESH::ModifiedMesh(meshSO, false, aMesh->NbNodes()==0); - if ( SMESH_Actor* actor = SMESH::FindActorByEntry( meshSO->GetID().c_str() )) if( actor->GetVisibility() ) actor->Update(); diff --git a/src/SMESHGUI/SMESHGUI_MeshOrderOp.cxx b/src/SMESHGUI/SMESHGUI_MeshOrderOp.cxx index 1f7c71067..dc2e34e98 100644 --- a/src/SMESHGUI/SMESHGUI_MeshOrderOp.cxx +++ b/src/SMESHGUI/SMESHGUI_MeshOrderOp.cxx @@ -24,6 +24,7 @@ #include "SMESHGUI.h" #include "SMESHGUI_Utils.h" +#include "SMESHGUI_VTKUtils.h" #include "SMESHGUI_MeshUtils.h" // SALOME GUI includes @@ -139,7 +140,10 @@ bool SMESHGUI_MeshOrderOp::onApply() bool res = myMgr ? myMgr->SetMeshOrder() : false; if( res ) + { SMESHGUI::Modified(); + SMESH::UpdateView(); + } delete myMgr; myMgr = 0; @@ -300,11 +304,6 @@ bool SMESHGUI_MeshOrderMgr::SetMeshOrder( const ListListId& theListListIds ) } } - // is it enough to set modified attribute on root mesh objects only? - // it is seems that modifcation flag will be set on child submeshes - // automatically (see SMESH::ModifiedMesh for details) - SMESH::ModifiedMesh( aMeshSObj, false, false ); - SMESH::submesh_array_array_var meshOrder = new SMESH::submesh_array_array(); meshOrder->length(theListListIds.count() ); ListListId::const_iterator it = theListListIds.constBegin(); diff --git a/src/SMESHGUI/SMESHGUI_Utils.cxx b/src/SMESHGUI/SMESHGUI_Utils.cxx index e6fdb1c15..70e4686c6 100644 --- a/src/SMESHGUI/SMESHGUI_Utils.cxx +++ b/src/SMESHGUI/SMESHGUI_Utils.cxx @@ -257,83 +257,6 @@ namespace SMESH return theSObject->GetFather(); } - void ModifiedMesh (_PTR(SObject) theSObject, bool theIsNotModif, bool isEmptyMesh) - { - _PTR(Study) aStudy = getStudy(); - if ( !aStudy || aStudy->GetProperties()->IsLocked()) - return; - - _PTR(StudyBuilder) aBuilder = aStudy->NewBuilder(); - _PTR(GenericAttribute) anAttr = - aBuilder->FindOrCreateAttribute(theSObject,"AttributePixMap"); - _PTR(AttributePixMap) aPixmap = anAttr; - - std::string pmName; - if (theIsNotModif) - pmName = "ICON_SMESH_TREE_MESH"; - else if ( isEmptyMesh ) - pmName = "ICON_SMESH_TREE_MESH_WARN"; - else - pmName = "ICON_SMESH_TREE_MESH_PARTIAL"; - aPixmap->SetPixMap( pmName ); - - _PTR(ChildIterator) anIter = aStudy->NewChildIterator(theSObject); - for ( ; anIter->More(); anIter->Next() ) { - _PTR(SObject) aSObj = anIter->Value(); - if ( aSObj->Tag() >= SMESH::Tag_FirstSubMesh ) - { - _PTR(ChildIterator) anIter1 = aStudy->NewChildIterator(aSObj); - for ( ; anIter1->More(); anIter1->Next()) - { - _PTR(SObject) aSObj1 = anIter1->Value(); - _PTR(SObject) aSObjectRef; - if (aSObj1->ReferencedObject(aSObjectRef)) - continue; // reference to an object - - anAttr = aBuilder->FindOrCreateAttribute(aSObj1, "AttributePixMap"); - aPixmap = anAttr; - - std::string entry = aSObj1->GetID(); - int objType = SMESHGUI_Selection::type( entry.c_str() ); - if ( objType == SMESH::HYPOTHESIS || objType == SMESH::ALGORITHM ) - continue; - - SMESH::SMESH_IDSource_var idSrc = SObjectToInterface( aSObj1 ); - if ( !idSrc->_is_nil() ) - { - SMESH::SMESH_GroupOnFilter_var gof = - SObjectToInterface( aSObj1 ); - const bool isGroupOnFilter = !gof->_is_nil(); - - bool isEmpty = false; - if ( !isGroupOnFilter ) // GetTypes() can be very long on GroupOnFilter! - { - SMESH::array_of_ElementType_var elemTypes = idSrc->GetTypes(); - isEmpty = ( elemTypes->length() == 0 ); - } - if ( isEmpty ) - aPixmap->SetPixMap("ICON_SMESH_TREE_MESH_WARN"); - else if ( objType != GROUP ) - aPixmap->SetPixMap( "ICON_SMESH_TREE_MESH" ); - else if ( isGroupOnFilter ) - aPixmap->SetPixMap( "ICON_SMESH_TREE_GROUP_ON_FILTER" ); - else - aPixmap->SetPixMap( "ICON_SMESH_TREE_GROUP" ); - } - else // is it necessary? - { - if ( !theIsNotModif ) - aPixmap->SetPixMap( pmName ); - else if ( objType == GROUP ) - aPixmap->SetPixMap( "ICON_SMESH_TREE_GROUP" ); - else - aPixmap->SetPixMap( "ICON_SMESH_TREE_MESH" ); - } - } - } - } - } - void ShowHelpFile (const QString& theHelpFileName) { LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication()); diff --git a/src/SMESHGUI/SMESHGUI_Utils.h b/src/SMESHGUI/SMESHGUI_Utils.h index 4a1a1c600..6ff20e8a2 100644 --- a/src/SMESHGUI/SMESHGUI_Utils.h +++ b/src/SMESHGUI/SMESHGUI_Utils.h @@ -158,9 +158,6 @@ SMESHGUI_EXPORT SMESHGUI_EXPORT _PTR(SObject) GetMeshOrSubmesh( _PTR(SObject) ); -SMESHGUI_EXPORT - void ModifiedMesh( _PTR(SObject), bool, bool = false ); - SMESHGUI_EXPORT void ShowHelpFile( const QString& ); diff --git a/src/SMESH_I/SMESH_Gen_i.cxx b/src/SMESH_I/SMESH_Gen_i.cxx index d1d807741..3a575aa0a 100644 --- a/src/SMESH_I/SMESH_Gen_i.cxx +++ b/src/SMESH_I/SMESH_Gen_i.cxx @@ -1947,6 +1947,7 @@ CORBA::Boolean SMESH_Gen_i::Compute( SMESH::SMESH_Mesh_ptr theMesh, bool ok = myGen.Compute( myLocMesh, myLocShape, how ); meshServant->CreateGroupServants(); // algos can create groups (issue 0020918) myLocMesh.GetMeshDS()->Modified(); + UpdateIcons( theMesh ); return ok; } } diff --git a/src/SMESH_I/SMESH_Gen_i.hxx b/src/SMESH_I/SMESH_Gen_i.hxx index 1cc0ae4aa..dc0f27f95 100644 --- a/src/SMESH_I/SMESH_Gen_i.hxx +++ b/src/SMESH_I/SMESH_Gen_i.hxx @@ -58,7 +58,7 @@ class SMESH_Mesh_i; class SALOME_LifeCycleCORBA; // =========================================================== -// Study context - stores study-connected objects references +// Study context - store study-connected objects references // ========================================================== class SMESH_I_EXPORT StudyContext { @@ -67,58 +67,22 @@ class SMESH_I_EXPORT StudyContext public: // constructor StudyContext() {} - // register object in the internal map and return its id - int addObject( std::string theIOR ) - { - int nextId = getNextId(); - mapIdToIOR.Bind( nextId, theIOR ); - return nextId; - } + int addObject( const std::string& theIOR ); // find the object id in the internal map by the IOR - int findId( std::string theIOR ) - { - TInt2StringMap::iterator imap; - for ( imap = mapIdToIOR.begin(); imap != mapIdToIOR.end(); ++imap ) { - if ( *imap == theIOR ) - return imap.Iterator().Key(); - } - return 0; - } + int findId( const std::string& theIOR ); // get object's IOR by id - std::string getIORbyId( const int theId ) - { - if ( mapIdToIOR.IsBound( theId ) ) - return mapIdToIOR( theId ); - return std::string(); - } + std::string getIORbyId( const int theId ); // get object's IOR by old id - std::string getIORbyOldId( const int theOldId ) - { - if ( mapIdToId.IsBound( theOldId ) ) - return getIORbyId( mapIdToId( theOldId )); - return std::string(); - } + std::string getIORbyOldId( const int theOldId ); // maps old object id to the new one (used when restoring data) - void mapOldToNew( const int oldId, const int newId ) { - mapIdToId.Bind( oldId, newId ); - } + void mapOldToNew( const int oldId, const int newId ); // get old id by a new one - int getOldId( const int newId ) { - TInt2IntMap::iterator imap; - for ( imap = mapIdToId.begin(); imap != mapIdToId.end(); ++imap ) { - if ( *imap == newId ) - return imap.Iterator().Key(); - } - return 0; - } + int getOldId( const int newId ); private: // get next free object identifier - int getNextId() - { - return mapIdToIOR.Extent() + 1; - } + int getNextId() { return mapIdToIOR.Extent() + 1; } TInt2StringMap mapIdToIOR; // persistent-to-transient map TInt2IntMap mapIdToId; // to translate object from persistent to transient form @@ -151,7 +115,7 @@ public: // Get the SALOMEDS::SObject corresponding to a CORBA object static SALOMEDS::SObject_ptr ObjectToSObject(CORBA::Object_ptr theObject); // Get the SALOMEDS::Study from naming service - static SALOMEDS::Study_ptr getStudyServant(); + static SALOMEDS::Study_var getStudyServant(); // Get GEOM Object corresponding to TopoDS_Shape GEOM::GEOM_Object_ptr ShapeToGeomObject (const TopoDS_Shape& theShape ); // Get TopoDS_Shape corresponding to GEOM_Object @@ -534,6 +498,7 @@ public: SMESH::SMESH_GroupBase_ptr theGroup, GEOM::GEOM_Object_ptr theShapeObject, const char* theName = 0); + void UpdateIcons(SMESH::SMESH_Mesh_ptr theMesh); bool AddHypothesisToShape(SMESH::SMESH_Mesh_ptr theMesh, GEOM::GEOM_Object_ptr theShapeObject, SMESH::SMESH_Hypothesis_ptr theHyp); diff --git a/src/SMESH_I/SMESH_Gen_i_1.cxx b/src/SMESH_I/SMESH_Gen_i_1.cxx index e1499f8a7..dc21b915c 100644 --- a/src/SMESH_I/SMESH_Gen_i_1.cxx +++ b/src/SMESH_I/SMESH_Gen_i_1.cxx @@ -208,7 +208,7 @@ SALOMEDS::SObject_ptr SMESH_Gen_i::ObjectToSObject(CORBA::Object_ptr theObject) //function : GetStudyPtr //purpose : Get study from naming service //======================================================================= -SALOMEDS::Study_ptr SMESH_Gen_i::getStudyServant() +SALOMEDS::Study_var SMESH_Gen_i::getStudyServant() { return SALOMEDS::Study::_duplicate(KERNEL::getStudyServant()); } @@ -396,7 +396,7 @@ void SMESH_Gen_i::SetName(SALOMEDS::SObject_ptr theSObject, void SMESH_Gen_i::SetPixMap(SALOMEDS::SObject_ptr theSObject, const char* thePixMap) { - if ( !theSObject->_is_nil() && thePixMap && strlen( thePixMap )) + if ( !theSObject->_is_nil() && thePixMap && thePixMap && thePixMap[0] ) { SALOMEDS::StudyBuilder_var aStudyBuilder = getStudyServant()->NewBuilder(); SALOMEDS::GenericAttribute_wrap anAttr = @@ -859,14 +859,87 @@ SALOMEDS::SObject_ptr return aHypSO._retn(); } +//======================================================================= +//function : UpdateIcons +//purpose : update icons of a mesh and its children upon mesh modification +//======================================================================= + +void SMESH_Gen_i::UpdateIcons( SMESH::SMESH_Mesh_ptr theMesh ) +{ + SMESH_Mesh_i* mesh_i = SMESH::DownCast< SMESH_Mesh_i* >( theMesh ); + if ( ! mesh_i ) + return; + + SALOMEDS::SObject_wrap so = ObjectToSObject( theMesh ); + if ( so->_is_nil() ) + return; + + // set icon of the mesh + if ( mesh_i->NbNodes() == 0 ) + SetPixMap( so, "ICON_SMESH_TREE_MESH_WARN" ); + else if ( mesh_i->IsComputedOK() ) + SetPixMap( so, "ICON_SMESH_TREE_MESH" ); + else + SetPixMap( so, "ICON_SMESH_TREE_MESH_PARTIAL" ); + + // set icons of sub-objects + SALOMEDS::Study_var study = getStudyServant(); + SALOMEDS::ChildIterator_wrap iter = study->NewChildIterator( so ); + for ( ; iter->More(); iter->Next() ) + { + so = iter->Value(); // 1st level child - root of algos, hyps, sub-meshes or groups + if ( so->Tag() < SMESH::Tag_FirstSubMesh ) + continue; + + SALOMEDS::ChildIterator_wrap subIter = study->NewChildIterator( so ); + for ( ; subIter->More(); subIter->Next() ) + { + so = subIter->Value(); // 2nd level child - a sub-mesh or group + + CORBA::Object_var obj = SObjectToObject( so ); + SMESH::SMESH_IDSource_var idSrc = SMESH::SMESH_IDSource::_narrow( obj ); + if ( idSrc->_is_nil() ) + continue; + + SMESH::SMESH_GroupBase_var grp = SMESH::SMESH_GroupBase::_narrow( obj ); + SMESH::SMESH_GroupOnFilter_var gof = SMESH::SMESH_GroupOnFilter::_narrow( obj ); + const bool isGroup = !grp->_is_nil(); + const bool isGroupOnFilter = !gof->_is_nil(); + + bool isEmpty = ( mesh_i->NbNodes() == 0 ); + if ( !isEmpty ) + { + if ( isGroupOnFilter ) // GetTypes() can be very long on GroupOnFilter! + { + SMESH::long_array_var nbByType = mesh_i->GetNbElementsByType(); + isEmpty = ( nbByType[ grp->GetType() ] == 0 ); + } + else + { + SMESH::array_of_ElementType_var elemTypes = idSrc->GetTypes(); + isEmpty = ( elemTypes->length() == 0 ); + } + } + if ( isEmpty ) + SetPixMap( so, "ICON_SMESH_TREE_MESH_WARN"); + else if ( !isGroup ) + SetPixMap( so, "ICON_SMESH_TREE_MESH" ); + else if ( isGroupOnFilter ) + SetPixMap( so, "ICON_SMESH_TREE_GROUP_ON_FILTER" ); + else + SetPixMap( so, "ICON_SMESH_TREE_GROUP" ); + } + } +} + //======================================================================= //function : GetMeshOrSubmeshByShape //purpose : //======================================================================= SALOMEDS::SObject_ptr - SMESH_Gen_i::GetMeshOrSubmeshByShape (SMESH::SMESH_Mesh_ptr theMesh, - GEOM::GEOM_Object_ptr theShape) +SMESH_Gen_i::GetMeshOrSubmeshByShape (SMESH::SMESH_Mesh_ptr theMesh, + GEOM::GEOM_Object_ptr theShape) { if(MYDEBUG) MESSAGE("GetMeshOrSubmeshByShape") SALOMEDS::SObject_wrap aMeshOrSubMesh; @@ -1232,3 +1305,85 @@ char* SMESH_Gen_i::GetParameters(CORBA::Object_ptr theObject) } return aResult._retn(); } + + + +// ============== +// Study context +// ============== + +//======================================================================= +//function : addObject +//purpose : register object in the internal map and return its id +//======================================================================= + +int StudyContext::addObject( const std::string& theIOR ) +{ + int nextId = getNextId(); + mapIdToIOR.Bind( nextId, theIOR ); + return nextId; +} + +//======================================================================= +//function : findId +//purpose : find the object id in the internal map by the IOR +//======================================================================= + +int StudyContext::findId( const std::string& theIOR ) +{ + TInt2StringMap::iterator imap; + for ( imap = mapIdToIOR.begin(); imap != mapIdToIOR.end(); ++imap ) { + if ( *imap == theIOR ) + return imap.Iterator().Key(); + } + return 0; +} + +//======================================================================= +//function : getIORbyId +//purpose : get object's IOR by id +//======================================================================= + +std::string StudyContext::getIORbyId( const int theId ) +{ + if ( mapIdToIOR.IsBound( theId ) ) + return mapIdToIOR( theId ); + return std::string(); +} + +//======================================================================= +//function : getIORbyOldId +//purpose : get object's IOR by old id +//======================================================================= + +std::string StudyContext::getIORbyOldId( const int theOldId ) +{ + if ( mapIdToId.IsBound( theOldId ) ) + return getIORbyId( mapIdToId( theOldId )); + return std::string(); +} + +//======================================================================= +//function : mapOldToNew +//purpose : maps old object id to the new one (used when restoring data) +//======================================================================= + +void StudyContext::mapOldToNew( const int oldId, const int newId ) +{ + mapIdToId.Bind( oldId, newId ); +} + +//======================================================================= +//function : getOldId +//purpose : get old id by a new one +//======================================================================= + +int StudyContext::getOldId( const int newId ) +{ + TInt2IntMap::iterator imap; + for ( imap = mapIdToId.begin(); imap != mapIdToId.end(); ++imap ) { + if ( *imap == newId ) + return imap.Iterator().Key(); + } + return 0; +} diff --git a/src/SMESH_I/SMESH_Mesh_i.cxx b/src/SMESH_I/SMESH_Mesh_i.cxx index 5110e337b..c7c3f54eb 100644 --- a/src/SMESH_I/SMESH_Mesh_i.cxx +++ b/src/SMESH_I/SMESH_Mesh_i.cxx @@ -299,6 +299,9 @@ void SMESH_Mesh_i::Clear() throw (SALOME::SALOME_Exception) } TPythonDump() << SMESH::SMESH_Mesh_var(_this()) << ".Clear()"; + + SMESH::SMESH_Mesh_var mesh = _this(); + _gen_i->UpdateIcons( mesh ); } //================================================================================ @@ -594,6 +597,7 @@ SMESH_Mesh_i::AddHypothesis(GEOM::GEOM_Object_ptr aSubShape, if ( !SMESH_Hypothesis::IsStatusFatal(status) ) { _gen_i->AddHypothesisToShape( mesh, aSubShape, anHyp ); + _gen_i->UpdateIcons( mesh ); } if(MYDEBUG) MESSAGE( " AddHypothesis(): status = " << status ); @@ -679,6 +683,7 @@ SMESH::Hypothesis_Status SMESH_Mesh_i::RemoveHypothesis(GEOM::GEOM_Object_ptr aS if ( !SMESH_Hypothesis::IsStatusFatal(status) ) { _gen_i->RemoveHypothesisFromShape( mesh, aSubShape, anHyp ); + _gen_i->UpdateIcons( mesh ); } // Update Python script if(_impl->HasShapeToMesh()) @@ -2705,6 +2710,9 @@ void SMESH_Mesh_i::onHypothesisModified() { if ( _preMeshInfo ) _preMeshInfo->ForgetOrLoad(); + + SMESH::SMESH_Mesh_var mesh = _this(); + _gen_i->UpdateIcons( mesh ); } //============================================================================= @@ -4991,6 +4999,17 @@ void SMESH_Mesh_i::CreateGroupServants() } } +//============================================================================= +/*! + * \brief Return true if all sub-meshes are computed OK - to update an icon + */ +//============================================================================= + +bool SMESH_Mesh_i::IsComputedOK() +{ + return _impl->IsComputedOK(); +} + //============================================================================= /*! * \brief Return groups cantained in _mapGroups by their IDs @@ -5968,6 +5987,9 @@ TListOfListOfInt SMESH_Mesh_i::findConcurrentSubMeshes() mesh.SetMeshOrder( subMeshOrder ); res = true; + SMESH::SMESH_Mesh_var me = _this(); + _gen_i->UpdateIcons( me ); + return res; } diff --git a/src/SMESH_I/SMESH_Mesh_i.hxx b/src/SMESH_I/SMESH_Mesh_i.hxx index 8cddc28e2..9fdde438c 100644 --- a/src/SMESH_I/SMESH_Mesh_i.hxx +++ b/src/SMESH_I/SMESH_Mesh_i.hxx @@ -396,8 +396,11 @@ public: const char* theGroupName) throw (SALOME::SALOME_Exception); + // =================================================== // Internal methods not available through CORBA // They are called by corresponding interface methods + // =================================================== + SMESH_Hypothesis::Hypothesis_Status addHypothesis(GEOM::GEOM_Object_ptr aSubShape, SMESH::SMESH_Hypothesis_ptr anHyp, std::string* anErrorText=0); @@ -455,6 +458,16 @@ public: */ void CreateGroupServants(); + /*! + * \brief Return true if all sub-meshes are computed OK - to update an icon + */ + bool IsComputedOK(); + + + // ==================================== + // SMESH_Mesh interface (continuation) + // ==================================== + /*! * \brief Return groups cantained in _mapGroups by their IDs */ @@ -649,10 +662,11 @@ public: * happen if mesh data is not yet fully loaded from the file of study. */ bool IsMeshInfoCorrect(); - /*! - * Returns mesh unstructed grid information. - */ - virtual SALOMEDS::TMPFile* GetVtkUgStream(); + /*! + * Returns mesh unstructed grid information. + */ + virtual SALOMEDS::TMPFile* GetVtkUgStream(); + std::map _mapSubMesh_i; //NRI std::map _mapSubMesh; //NRI diff --git a/src/SMESH_I/SMESH_PythonDump.cxx b/src/SMESH_I/SMESH_PythonDump.cxx index 0828fc5e4..cd2e6ba3a 100644 --- a/src/SMESH_I/SMESH_PythonDump.cxx +++ b/src/SMESH_I/SMESH_PythonDump.cxx @@ -349,7 +349,6 @@ namespace SMESH { if ( CORBA::is_nil( theArg ) ) return *this << "None"; - SMESH_Gen_i* aSMESHGen = SMESH_Gen_i::GetSMESHGen(); SALOMEDS::SObject_wrap aSObject = SMESH_Gen_i::ObjectToSObject(theArg); if(!aSObject->_is_nil()) { diff --git a/src/SMESH_SWIG/CMakeLists.txt b/src/SMESH_SWIG/CMakeLists.txt index b57d2b4df..826decc60 100644 --- a/src/SMESH_SWIG/CMakeLists.txt +++ b/src/SMESH_SWIG/CMakeLists.txt @@ -21,7 +21,6 @@ # scripts / static SET(_bin_SCRIPTS - smesh.py ex00_all.py ex01_cube2build.py ex02_cube2primitive.py diff --git a/src/SMESH_SWIG/smesh.py b/src/SMESH_SWIG/smesh.py deleted file mode 100644 index 92a88aaf3..000000000 --- a/src/SMESH_SWIG/smesh.py +++ /dev/null @@ -1,122 +0,0 @@ -# -*- coding: iso-8859-1 -*- -# Copyright (C) 2007-2016 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 -# -# 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, 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 -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -# - -# File : smesh.py -# Author : Francis KLOSS, OCC -# Module : SMESH -# -"""@package smesh - \brief Module smesh -""" - -import inspect -import salome -from salome import * - -import geompy - -import SMESH, SALOMEDS -from salome.smesh import smeshBuilder - -# retrieve SMESH engine in try/except block -# to avoid problems in some cases, e.g. when generating documentation -try: - # get instance of class smeshBuilder - engineSmesh = salome.lcc.FindOrLoadComponent( "FactoryServer", "SMESH" ) - smesh = smeshBuilder.New(True,engineSmesh) -except: - print("exception in smesh.py: instance creation failed") - smesh = None - pass - -# load plugins and add dynamically generated methods to Mesh class, -# the same for global variables declared by plug-ins -from salome.smesh.smeshBuilder import * -from salome.smesh.smeshBuilder import Mesh, algoCreator -for pluginName in os.environ[ "SMESH_MeshersList" ].split( ":" ): - # - #print "pluginName: ", pluginName - pluginBuilderName = pluginName + "Builder" - try: - exec( "from salome.%s.%s import *" % (pluginName, pluginBuilderName)) - except Exception as e: - from salome_utils import verbose - if verbose(): print("Exception while loading %s: %s" % ( pluginBuilderName, e )) - continue - exec( "from salome.%s import %s" % (pluginName, pluginBuilderName)) - plugin = eval( pluginBuilderName ) - - # add methods creating algorithms to Mesh - for k in dir( plugin ): - if k[0] == '_': continue - algo = getattr( plugin, k ) - if inspect.isclass(algo) and hasattr(algo, "meshMethod"): - if not hasattr( Mesh, algo.meshMethod ): - setattr( Mesh, algo.meshMethod, algoCreator() ) - pass - getattr( Mesh, algo.meshMethod ).add( algo ) - pass - pass - pass -del pluginName - -# export the methods of smeshBuilder -if smesh: - for k in dir( smesh ): - if k[0] == '_': continue - globals()[k] = getattr( smesh, k ) - del k - pass - -print(""" -=============================================================================== -WARNING: -Usage of smesh.py is deprecated in SALOME V7.2! -smesh.py will be removed in a future version! -TODO: -The following changes in your scripts are required to avoid this message: - -replace -------- - -import smesh, SMESH - -with ----- - -import SMESH -from salome.smesh import smeshBuilder -smesh = smeshBuilder.New() - -you also need to modify some lines where smeshBuilder is used instead of smesh - -algo=smesh.xxxx ==> algo=smeshBuilder.xxxx - -See also SMESH User's Guide for more details - -WARNING: -The smesh.py module works correctly only in the first created study. -It does not work in the second, third, etc studies! - -=============================================================================== -""") diff --git a/src/SMESH_SWIG/smeshBuilder.py b/src/SMESH_SWIG/smeshBuilder.py index 38fba8060..8706efa1b 100644 --- a/src/SMESH_SWIG/smeshBuilder.py +++ b/src/SMESH_SWIG/smeshBuilder.py @@ -1823,9 +1823,6 @@ class Mesh(metaclass = MeshMeta): pass if salome.sg.hasDesktop(): if not isinstance( refresh, list): # not a call from subMesh.Compute() - smeshgui = salome.ImportComponentGUI("SMESH") - smeshgui.Init() - smeshgui.SetMeshIcon( salome.ObjectToID( self.mesh ), ok, (self.NbNodes()==0) ) if refresh: salome.sg.updateObjBrowser() return ok @@ -1971,9 +1968,6 @@ class Mesh(metaclass = MeshMeta): self.mesh.Clear() if ( salome.sg.hasDesktop() ): - smeshgui = salome.ImportComponentGUI("SMESH") - smeshgui.Init() - smeshgui.SetMeshIcon( salome.ObjectToID( self.mesh ), False, True ) if refresh: salome.sg.updateObjBrowser() def ClearSubMesh(self, geomId, refresh=False): @@ -1987,9 +1981,6 @@ class Mesh(metaclass = MeshMeta): self.mesh.ClearSubMesh(geomId) if salome.sg.hasDesktop(): - smeshgui = salome.ImportComponentGUI("SMESH") - smeshgui.Init() - smeshgui.SetMeshIcon( salome.ObjectToID( self.mesh ), False, True ) if refresh: salome.sg.updateObjBrowser() def AutomaticTetrahedralization(self, fineness=0): @@ -6903,9 +6894,6 @@ class submeshProxy(SMESH._objref_SMESH_subMesh): ok = self.mesh.Compute( self.GetSubShape(),refresh=[] ) if salome.sg.hasDesktop(): - smeshgui = salome.ImportComponentGUI("SMESH") - smeshgui.Init() - smeshgui.SetMeshIcon( salome.ObjectToID( self ), ok, (self.GetNumberOfElements()==0) ) if refresh: salome.sg.updateObjBrowser() pass diff --git a/src/SMESH_SWIG_WITHIHM/libSMESH_Swig.cxx b/src/SMESH_SWIG_WITHIHM/libSMESH_Swig.cxx index e33be0832..f44a29d90 100644 --- a/src/SMESH_SWIG_WITHIHM/libSMESH_Swig.cxx +++ b/src/SMESH_SWIG_WITHIHM/libSMESH_Swig.cxx @@ -144,9 +144,9 @@ namespace _PTR(Study) study = SMESH::getStudy(); if ( study ) { - sobject = study->FindObjectID( uid ); - if ( !sobject ) - sobject = study->FindObjectIOR( uid ); + sobject = study->FindObjectID( uid ); + if ( !sobject ) + sobject = study->FindObjectIOR( uid ); } } return sobject; @@ -168,26 +168,26 @@ namespace { if ( uid ) { - ViewManagerList vms = app->viewManagers(); - for ( int i = 0; i < vms.count() && !window; i++ ) - { - SUIT_ViewManager* vm = vms[i]; - QVector vws = vm->getViews(); - for ( int j = 0; j < vws.count() && !window; j++) - { - SUIT_ViewWindow* vw = vws[0]; - if ( uid == vw->getId() ) - window = dynamic_cast( vm->getViewModel() ); - } - } + ViewManagerList vms = app->viewManagers(); + for ( int i = 0; i < vms.count() && !window; i++ ) + { + SUIT_ViewManager* vm = vms[i]; + QVector vws = vm->getViews(); + for ( int j = 0; j < vws.count() && !window; j++) + { + SUIT_ViewWindow* vw = vws[0]; + if ( uid == vw->getId() ) + window = dynamic_cast( vm->getViewModel() ); + } + } } else { - SUIT_ViewManager* vm = app->getViewManager( SVTK_Viewer::Type(), create ); - if ( vm ) - { - window = dynamic_cast( vm->getViewModel() ); - } + SUIT_ViewManager* vm = app->getViewManager( SVTK_Viewer::Type(), create ); + if ( vm ) + { + window = dynamic_cast( vm->getViewModel() ); + } } } return window; @@ -209,11 +209,11 @@ namespace foreach( SUIT_ViewManager* vm, vms ) { if ( vm && vm->getType() == SVTK_Viewer::Type() ) - { + { SALOME_View* view = dynamic_cast( vm->getViewModel() ); if ( view ) - views << view; - } + views << view; + } } } return views; @@ -255,44 +255,44 @@ namespace if ( actor ) { actor->GetNodeColor( props.nodeColor.r, - props.nodeColor.g, - props.nodeColor.b ); + props.nodeColor.g, + props.nodeColor.b ); props.markerType = actor->GetMarkerType(); props.markerScale = actor->GetMarkerScale(); actor->GetEdgeColor( props.edgeColor.r, - props.edgeColor.g, - props.edgeColor.b ); + props.edgeColor.g, + props.edgeColor.b ); props.edgeWidth = qMax( (int)actor->GetLineWidth(), 1 ); actor->GetSufaceColor( props.surfaceColor.r, - props.surfaceColor.g, - props.surfaceColor.b, - props.surfaceColor.delta ); + props.surfaceColor.g, + props.surfaceColor.b, + props.surfaceColor.delta ); actor->GetVolumeColor( props.volumeColor.r, - props.volumeColor.g, - props.volumeColor.b, - props.volumeColor.delta ); + props.volumeColor.g, + props.volumeColor.b, + props.volumeColor.delta ); actor->Get0DColor( props.elem0dColor.r, - props.elem0dColor.g, - props.elem0dColor.b ); + props.elem0dColor.g, + props.elem0dColor.b ); props.elem0dSize = qMax( (int)actor->Get0DSize(), 1 ); actor->GetBallColor( props.ballColor.r, - props.ballColor.g, - props.ballColor.b ); + props.ballColor.g, + props.ballColor.b ); props.ballScale = qMax( actor->GetBallScale(), 1e-2 ); actor->GetOutlineColor( props.outlineColor.r, - props.outlineColor.g, - props.outlineColor.b ); + props.outlineColor.g, + props.outlineColor.b ); props.outlineWidth = qMax( (int)actor->GetOutlineWidth(), 1 ); actor->GetFacesOrientationColor( props.orientationColor.r, - props.orientationColor.g, - props.orientationColor.b ); + props.orientationColor.g, + props.orientationColor.b ); props.orientationScale = actor->GetFacesOrientationScale(); props.orientation3d = actor->GetFacesOrientation3DVectors(); @@ -316,44 +316,44 @@ namespace if ( actor ) { actor->SetNodeColor( props.nodeColor.r, - props.nodeColor.g, - props.nodeColor.b ); + props.nodeColor.g, + props.nodeColor.b ); if ( props.markerType != VTK::MT_USER ) - actor->SetMarkerStd( props.markerType, props.markerScale ); + actor->SetMarkerStd( props.markerType, props.markerScale ); actor->SetEdgeColor( props.edgeColor.r, - props.edgeColor.g, - props.edgeColor.b ); + props.edgeColor.g, + props.edgeColor.b ); actor->SetLineWidth( qMax( (double)props.edgeWidth, 1. ) ); actor->SetSufaceColor( props.surfaceColor.r, - props.surfaceColor.g, - props.surfaceColor.b, - props.surfaceColor.delta ); + props.surfaceColor.g, + props.surfaceColor.b, + props.surfaceColor.delta ); actor->SetVolumeColor( props.volumeColor.r, - props.volumeColor.g, - props.volumeColor.b, - props.volumeColor.delta ); + props.volumeColor.g, + props.volumeColor.b, + props.volumeColor.delta ); actor->Set0DColor( props.elem0dColor.r, - props.elem0dColor.g, - props.elem0dColor.b ); + props.elem0dColor.g, + props.elem0dColor.b ); actor->Set0DSize( qMax( (double)props.elem0dSize, 1. ) ); actor->SetBallColor( props.ballColor.r, - props.ballColor.g, - props.ballColor.b ); + props.ballColor.g, + props.ballColor.b ); actor->SetBallScale( qMax( props.ballScale, 1e-2 ) ); actor->SetOutlineColor( props.outlineColor.r, - props.outlineColor.g, - props.outlineColor.b ); + props.outlineColor.g, + props.outlineColor.b ); actor->SetOutlineWidth( qMax( (double)props.outlineWidth, 1. ) ); actor->SetFacesOrientationColor( props.orientationColor.r, - props.orientationColor.g, - props.orientationColor.b ); + props.orientationColor.g, + props.orientationColor.b ); actor->SetFacesOrientationScale( props.orientationScale ); actor->SetFacesOrientation3DVectors( props.orientation3d ); @@ -559,7 +559,7 @@ void SMESH_Swig::init() SalomeApp_Application* app = dynamic_cast( session->activeApplication() ); if ( !SMESHGUI::GetSMESHGUI() ) - app->loadModule( "Mesh" ); + app->loadModule( "Mesh" ); } }; @@ -584,13 +584,13 @@ const char* SMESH_Swig::publish(const char* ior, const char* name) if ( !CORBA::is_nil( object ) ) { SALOMEDS::SObject_var sobject = - SMESHGUI::GetSMESHGen()->PublishInStudy( SALOMEDS::SObject::_nil(), - object.in(), - name ); + SMESHGUI::GetSMESHGen()->PublishInStudy( SALOMEDS::SObject::_nil(), + object.in(), + name ); if ( !CORBA::is_nil( sobject ) ) - { - uid = sobject->GetID(); - } + { + uid = sobject->GetID(); + } sobject->UnRegister(); } @@ -634,7 +634,7 @@ void SMESH_Swig::display(const char* uid, int viewUid, bool updateViewer) { SALOME_View* view = uid2wnd( myViewUid, true ); // create view if it's not present if ( view ) - LightApp_Displayer::FindDisplayer( "Mesh", true )->Display( myUid, myIsUpdate, view ); + LightApp_Displayer::FindDisplayer( "Mesh", true )->Display( myUid, myIsUpdate, view ); } }; @@ -668,15 +668,15 @@ void SMESH_Swig::erase(const char* uid, int viewUid, bool updateViewer) { if ( myViewUid == -1 ) { - QList views = windows(); - foreach( SALOME_View* view, views ) - LightApp_Displayer::FindDisplayer( "Mesh", true )->Erase( myUid, true, myIsUpdate, view ); + QList views = windows(); + foreach( SALOME_View* view, views ) + LightApp_Displayer::FindDisplayer( "Mesh", true )->Erase( myUid, true, myIsUpdate, view ); } else { - SALOME_View* view = uid2wnd( myViewUid ); - if ( view ) - LightApp_Displayer::FindDisplayer( "Mesh", true )->Erase( myUid, true, myIsUpdate, view ); + SALOME_View* view = uid2wnd( myViewUid ); + if ( view ) + LightApp_Displayer::FindDisplayer( "Mesh", true )->Erase( myUid, true, myIsUpdate, view ); } } }; @@ -703,7 +703,7 @@ void SMESH_Swig::update(const char* uid) virtual void Execute() { Handle(SALOME_InteractiveObject) io = - new SALOME_InteractiveObject( myUid, "SMESH", "" ); + new SALOME_InteractiveObject( myUid, "SMESH", "" ); SMESH::Update( io, true ); } }; @@ -775,7 +775,7 @@ public: QList views = windows(); foreach( SALOME_View* view, views ) { - setProperties( view, myUid, myProps ); + setProperties( view, myUid, myProps ); } } else @@ -867,7 +867,7 @@ public: { actor->SetPointsLabeled( myNumbering ); if ( view ) - view->Repaint(); + view->Repaint(); } } }; @@ -954,7 +954,7 @@ public: { actor->SetCellsLabeled( myNumbering ); if ( view ) - view->Repaint(); + view->Repaint(); } } }; @@ -1040,7 +1040,7 @@ public: { actor->SetRepresentation( myMode ); if ( view ) - view->Repaint(); + view->Repaint(); } } }; @@ -1125,11 +1125,11 @@ public: if ( actor ) { if ( myShrink ) - actor->SetShrink(); + actor->SetShrink(); else - actor->UnShrink(); + actor->UnShrink(); if ( view ) - view->Repaint(); + view->Repaint(); } } }; @@ -1215,7 +1215,7 @@ public: { actor->SetOpacity( myOpacity ); if ( view ) - view->Repaint(); + view->Repaint(); } } }; @@ -1301,7 +1301,7 @@ public: { actor->SetFacesOriented( myShown ); if ( view ) - view->Repaint(); + view->Repaint(); } } }; @@ -1387,7 +1387,7 @@ public: { actor->SetEntityMode( myEntities ); if ( view ) - view->Repaint(); + view->Repaint(); } } }; @@ -1577,7 +1577,7 @@ void SMESH_Swig::UnSetHypothesis(const char* /*uid*/) const char* SMESH_Swig::AddSubMesh(const char* /*meshUid*/, const char* ior, int /*shapeType*/, - const char* name) + const char* name) { deprecated("SMESH_Swig::AddSubMesh", "SMESH_Swig::publish"); return publish( ior, name ); @@ -1597,7 +1597,7 @@ const char* SMESH_Swig::AddSubMeshOnShape(const char* /*meshUid*/, const char* /*shapeUid*/, const char* ior, int /*shapeType*/, - const char* name) + const char* name) { deprecated("SMESH_Swig::AddSubMeshOnShape", "SMESH_Swig::publish"); return publish( ior, name ); @@ -1887,7 +1887,7 @@ public: { SVTK_ViewWindow* vw = dynamic_cast( model->getViewManager()->getActiveView() ); if ( vw ) - myResult = (SelectionMode)vw->SelectionMode(); + myResult = (SelectionMode)vw->SelectionMode(); } } }; @@ -1925,25 +1925,25 @@ public: SVTK_ViewWindow* vw = dynamic_cast( model->getViewManager()->getActiveView() ); if ( vw ) { - SelectionMode previousMode = (SelectionMode)vw->SelectionMode(); - bool switchPointMode = ( previousMode == Node && mySelectionMode != Node ) || - ( previousMode != Node && mySelectionMode == Node ); - if ( switchPointMode ) - { - vtkRenderer* renderer = vw->getRenderer(); - VTK::ActorCollectionCopy actors( renderer->GetActors() ); - vtkActorCollection* collection = actors.GetActors(); - collection->InitTraversal(); - while ( vtkActor* vtkActor = collection->GetNextActor() ) - { - if ( SMESH_Actor* actor = dynamic_cast( vtkActor ) ) - { - if ( actor->GetVisibility() ) - actor->SetPointRepresentation( mySelectionMode == Node ); - } - } - } - vw->SetSelectionMode( mySelectionMode ); + SelectionMode previousMode = (SelectionMode)vw->SelectionMode(); + bool switchPointMode = ( previousMode == Node && mySelectionMode != Node ) || + ( previousMode != Node && mySelectionMode == Node ); + if ( switchPointMode ) + { + vtkRenderer* renderer = vw->getRenderer(); + VTK::ActorCollectionCopy actors( renderer->GetActors() ); + vtkActorCollection* collection = actors.GetActors(); + collection->InitTraversal(); + while ( vtkActor* vtkActor = collection->GetNextActor() ) + { + if ( SMESH_Actor* actor = dynamic_cast( vtkActor ) ) + { + if ( actor->GetVisibility() ) + actor->SetPointRepresentation( mySelectionMode == Node ); + } + } + } + vw->SetSelectionMode( mySelectionMode ); } } } -- 2.39.2