Restore change of mesh icon depending on its status

now icons are updated on the engine side

+ Remove deprecated smesh.py
This commit is contained in:
eap 2018-07-10 17:41:10 +03:00
parent c21442db90
commit 1b80c8bc60
20 changed files with 362 additions and 406 deletions

View File

@ -1336,6 +1336,41 @@ bool SMESH_Mesh::HasModificationsToDiscard() const
return false; 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 * \brief Check if any groups of the same type have equal names

View File

@ -235,6 +235,11 @@ class SMESH_EXPORT SMESH_Mesh
*/ */
bool HasModificationsToDiscard() const; 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 * \brief Return data map of descendant to ancestor shapes
*/ */

View File

@ -261,7 +261,7 @@ public:
* none mesh entity is bound to it * none mesh entity is bound to it
*/ */
void SetIsAlwaysComputed(bool isAlCo); void SetIsAlwaysComputed(bool isAlCo);
bool IsAlwaysComputed() { return _alwaysComputed; } bool IsAlwaysComputed() const { return _alwaysComputed; }
bool SubMeshesComputed(bool * isFailedToCompute=0) const; bool SubMeshesComputed(bool * isFailedToCompute=0) const;

View File

@ -1942,10 +1942,6 @@ void SMESHGUI::OnEditDelete()
else if ( !aSubMesh->_is_nil() ) { // DELETE SUBMESH else if ( !aSubMesh->_is_nil() ) { // DELETE SUBMESH
SMESH::SMESH_Mesh_var aMesh = aSubMesh->GetFather(); SMESH::SMESH_Mesh_var aMesh = aSubMesh->GetFather();
aMesh->RemoveSubMesh( aSubMesh ); aMesh->RemoveSubMesh( aSubMesh );
_PTR(SObject) aMeshSO = SMESH::FindSObject(aMesh);
if (aMeshSO)
SMESH::ModifiedMesh(aMeshSO, false, aMesh->NbNodes()==0);
} }
else { else {
Handle(SALOME_InteractiveObject) IObject = new SALOME_InteractiveObject 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 if ( aMesh->NbNodes() == 0 ) // imported mesh is not empty
SMESH::RemoveVisualObjectWithActors(IOS->getEntry(), true); SMESH::RemoveVisualObjectWithActors(IOS->getEntry(), true);
_PTR(SObject) aMeshSObj = SMESH::FindSObject(aMesh); _PTR(SObject) aMeshSObj = SMESH::FindSObject(aMesh);
SMESH::ModifiedMesh( aMeshSObj, false, true);
// hide groups and submeshes // hide groups and submeshes
_PTR(ChildIterator) anIter = _PTR(ChildIterator) anIter =
SMESH::getStudy()->NewChildIterator( aMeshSObj ); SMESH::getStudy()->NewChildIterator( aMeshSObj );

View File

@ -925,10 +925,6 @@ void SMESHGUI_BaseComputeOp::computeMesh()
// NPAL16631: if ( !memoryLack ) // 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 ); update( UF_ObjBrowser | UF_Model );
// SHOW MESH // SHOW MESH

View File

@ -317,7 +317,6 @@ void SMESHGUI_GenericHypothesisCreator::onDialogFinished( int result )
if( !aSubMesh->_is_nil() ) if( !aSubMesh->_is_nil() )
aMesh = aSubMesh->GetFather(); aMesh = aSubMesh->GetFather();
_PTR(SObject) meshSO = SMESH::FindSObject( aMesh ); _PTR(SObject) meshSO = SMESH::FindSObject( aMesh );
SMESH::ModifiedMesh( meshSO, false, aMesh->NbNodes()==0);
SMESH_Actor* actor = SMESH::FindActorByEntry( meshSO->GetID().c_str() ); SMESH_Actor* actor = SMESH::FindActorByEntry( meshSO->GetID().c_str() );
if( actor && actor->GetVisibility() ) if( actor && actor->GetVisibility() )
actor->Update(); actor->Update();

View File

@ -631,12 +631,6 @@ namespace SMESH
try { try {
CORBA::String_var error; CORBA::String_var error;
res = aMesh->AddHypothesis(aShapeObject, aHyp, error.out()); 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) { if (res > SMESH::HYP_OK) {
wc.suspend(); wc.suspend();
processHypothesisStatus(res, aHyp, true, error.in() ); processHypothesisStatus(res, aHyp, true, error.in() );
@ -668,11 +662,6 @@ namespace SMESH
{ {
CORBA::String_var error; CORBA::String_var error;
res = aMesh->AddHypothesis( aShapeObject, aHyp, error.out() ); 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) { if (res > SMESH::HYP_OK) {
wc.suspend(); wc.suspend();
processHypothesisStatus( res, aHyp, true, error.in() ); processHypothesisStatus( res, aHyp, true, error.in() );
@ -763,9 +752,6 @@ namespace SMESH
} }
if ( _PTR(SObject) meshSO = SMESH::FindSObject(aMesh) ) 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 ( SMESH_Actor* actor = SMESH::FindActorByEntry( meshSO->GetID().c_str() ))
if( actor->GetVisibility() ) if( actor->GetVisibility() )
actor->Update(); actor->Update();

View File

@ -24,6 +24,7 @@
#include "SMESHGUI.h" #include "SMESHGUI.h"
#include "SMESHGUI_Utils.h" #include "SMESHGUI_Utils.h"
#include "SMESHGUI_VTKUtils.h"
#include "SMESHGUI_MeshUtils.h" #include "SMESHGUI_MeshUtils.h"
// SALOME GUI includes // SALOME GUI includes
@ -139,7 +140,10 @@ bool SMESHGUI_MeshOrderOp::onApply()
bool res = myMgr ? myMgr->SetMeshOrder() : false; bool res = myMgr ? myMgr->SetMeshOrder() : false;
if( res ) if( res )
{
SMESHGUI::Modified(); SMESHGUI::Modified();
SMESH::UpdateView();
}
delete myMgr; delete myMgr;
myMgr = 0; 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(); SMESH::submesh_array_array_var meshOrder = new SMESH::submesh_array_array();
meshOrder->length(theListListIds.count() ); meshOrder->length(theListListIds.count() );
ListListId::const_iterator it = theListListIds.constBegin(); ListListId::const_iterator it = theListListIds.constBegin();

View File

@ -257,83 +257,6 @@ namespace SMESH
return theSObject->GetFather(); 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<SMESH::SMESH_IDSource>( aSObj1 );
if ( !idSrc->_is_nil() )
{
SMESH::SMESH_GroupOnFilter_var gof =
SObjectToInterface<SMESH::SMESH_GroupOnFilter>( 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) void ShowHelpFile (const QString& theHelpFileName)
{ {
LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication()); LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication());

View File

@ -158,9 +158,6 @@ SMESHGUI_EXPORT
SMESHGUI_EXPORT SMESHGUI_EXPORT
_PTR(SObject) GetMeshOrSubmesh( _PTR(SObject) ); _PTR(SObject) GetMeshOrSubmesh( _PTR(SObject) );
SMESHGUI_EXPORT
void ModifiedMesh( _PTR(SObject), bool, bool = false );
SMESHGUI_EXPORT SMESHGUI_EXPORT
void ShowHelpFile( const QString& ); void ShowHelpFile( const QString& );

View File

@ -1947,6 +1947,7 @@ CORBA::Boolean SMESH_Gen_i::Compute( SMESH::SMESH_Mesh_ptr theMesh,
bool ok = myGen.Compute( myLocMesh, myLocShape, how ); bool ok = myGen.Compute( myLocMesh, myLocShape, how );
meshServant->CreateGroupServants(); // algos can create groups (issue 0020918) meshServant->CreateGroupServants(); // algos can create groups (issue 0020918)
myLocMesh.GetMeshDS()->Modified(); myLocMesh.GetMeshDS()->Modified();
UpdateIcons( theMesh );
return ok; return ok;
} }
} }

View File

@ -58,7 +58,7 @@ class SMESH_Mesh_i;
class SALOME_LifeCycleCORBA; class SALOME_LifeCycleCORBA;
// =========================================================== // ===========================================================
// Study context - stores study-connected objects references // Study context - store study-connected objects references
// ========================================================== // ==========================================================
class SMESH_I_EXPORT StudyContext class SMESH_I_EXPORT StudyContext
{ {
@ -67,58 +67,22 @@ class SMESH_I_EXPORT StudyContext
public: public:
// constructor // constructor
StudyContext() {} StudyContext() {}
// register object in the internal map and return its id // register object in the internal map and return its id
int addObject( std::string theIOR ) int addObject( const std::string& theIOR );
{
int nextId = getNextId();
mapIdToIOR.Bind( nextId, theIOR );
return nextId;
}
// find the object id in the internal map by the IOR // find the object id in the internal map by the IOR
int findId( std::string theIOR ) int 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;
}
// get object's IOR by id // get object's IOR by id
std::string getIORbyId( const int theId ) std::string getIORbyId( const int theId );
{
if ( mapIdToIOR.IsBound( theId ) )
return mapIdToIOR( theId );
return std::string();
}
// get object's IOR by old id // get object's IOR by old id
std::string getIORbyOldId( const int theOldId ) std::string getIORbyOldId( const int theOldId );
{
if ( mapIdToId.IsBound( theOldId ) )
return getIORbyId( mapIdToId( theOldId ));
return std::string();
}
// maps old object id to the new one (used when restoring data) // maps old object id to the new one (used when restoring data)
void mapOldToNew( const int oldId, const int newId ) { void mapOldToNew( const int oldId, const int newId );
mapIdToId.Bind( oldId, newId );
}
// get old id by a new one // get old id by a new one
int getOldId( const int newId ) { 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;
}
private: private:
// get next free object identifier // get next free object identifier
int getNextId() int getNextId() { return mapIdToIOR.Extent() + 1; }
{
return mapIdToIOR.Extent() + 1;
}
TInt2StringMap mapIdToIOR; // persistent-to-transient map TInt2StringMap mapIdToIOR; // persistent-to-transient map
TInt2IntMap mapIdToId; // to translate object from persistent to transient form TInt2IntMap mapIdToId; // to translate object from persistent to transient form
@ -151,7 +115,7 @@ public:
// Get the SALOMEDS::SObject corresponding to a CORBA object // Get the SALOMEDS::SObject corresponding to a CORBA object
static SALOMEDS::SObject_ptr ObjectToSObject(CORBA::Object_ptr theObject); static SALOMEDS::SObject_ptr ObjectToSObject(CORBA::Object_ptr theObject);
// Get the SALOMEDS::Study from naming service // Get the SALOMEDS::Study from naming service
static SALOMEDS::Study_ptr getStudyServant(); static SALOMEDS::Study_var getStudyServant();
// Get GEOM Object corresponding to TopoDS_Shape // Get GEOM Object corresponding to TopoDS_Shape
GEOM::GEOM_Object_ptr ShapeToGeomObject (const TopoDS_Shape& theShape ); GEOM::GEOM_Object_ptr ShapeToGeomObject (const TopoDS_Shape& theShape );
// Get TopoDS_Shape corresponding to GEOM_Object // Get TopoDS_Shape corresponding to GEOM_Object
@ -534,6 +498,7 @@ public:
SMESH::SMESH_GroupBase_ptr theGroup, SMESH::SMESH_GroupBase_ptr theGroup,
GEOM::GEOM_Object_ptr theShapeObject, GEOM::GEOM_Object_ptr theShapeObject,
const char* theName = 0); const char* theName = 0);
void UpdateIcons(SMESH::SMESH_Mesh_ptr theMesh);
bool AddHypothesisToShape(SMESH::SMESH_Mesh_ptr theMesh, bool AddHypothesisToShape(SMESH::SMESH_Mesh_ptr theMesh,
GEOM::GEOM_Object_ptr theShapeObject, GEOM::GEOM_Object_ptr theShapeObject,
SMESH::SMESH_Hypothesis_ptr theHyp); SMESH::SMESH_Hypothesis_ptr theHyp);

View File

@ -208,7 +208,7 @@ SALOMEDS::SObject_ptr SMESH_Gen_i::ObjectToSObject(CORBA::Object_ptr theObject)
//function : GetStudyPtr //function : GetStudyPtr
//purpose : Get study from naming service //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()); 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, void SMESH_Gen_i::SetPixMap(SALOMEDS::SObject_ptr theSObject,
const char* thePixMap) 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::StudyBuilder_var aStudyBuilder = getStudyServant()->NewBuilder();
SALOMEDS::GenericAttribute_wrap anAttr = SALOMEDS::GenericAttribute_wrap anAttr =
@ -859,14 +859,87 @@ SALOMEDS::SObject_ptr
return aHypSO._retn(); 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 //function : GetMeshOrSubmeshByShape
//purpose : //purpose :
//======================================================================= //=======================================================================
SALOMEDS::SObject_ptr SALOMEDS::SObject_ptr
SMESH_Gen_i::GetMeshOrSubmeshByShape (SMESH::SMESH_Mesh_ptr theMesh, SMESH_Gen_i::GetMeshOrSubmeshByShape (SMESH::SMESH_Mesh_ptr theMesh,
GEOM::GEOM_Object_ptr theShape) GEOM::GEOM_Object_ptr theShape)
{ {
if(MYDEBUG) MESSAGE("GetMeshOrSubmeshByShape") if(MYDEBUG) MESSAGE("GetMeshOrSubmeshByShape")
SALOMEDS::SObject_wrap aMeshOrSubMesh; SALOMEDS::SObject_wrap aMeshOrSubMesh;
@ -1232,3 +1305,85 @@ char* SMESH_Gen_i::GetParameters(CORBA::Object_ptr theObject)
} }
return aResult._retn(); 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;
}

View File

@ -299,6 +299,9 @@ void SMESH_Mesh_i::Clear() throw (SALOME::SALOME_Exception)
} }
TPythonDump() << SMESH::SMESH_Mesh_var(_this()) << ".Clear()"; 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) ) if ( !SMESH_Hypothesis::IsStatusFatal(status) )
{ {
_gen_i->AddHypothesisToShape( mesh, aSubShape, anHyp ); _gen_i->AddHypothesisToShape( mesh, aSubShape, anHyp );
_gen_i->UpdateIcons( mesh );
} }
if(MYDEBUG) MESSAGE( " AddHypothesis(): status = " << status ); 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) ) if ( !SMESH_Hypothesis::IsStatusFatal(status) )
{ {
_gen_i->RemoveHypothesisFromShape( mesh, aSubShape, anHyp ); _gen_i->RemoveHypothesisFromShape( mesh, aSubShape, anHyp );
_gen_i->UpdateIcons( mesh );
} }
// Update Python script // Update Python script
if(_impl->HasShapeToMesh()) if(_impl->HasShapeToMesh())
@ -2705,6 +2710,9 @@ void SMESH_Mesh_i::onHypothesisModified()
{ {
if ( _preMeshInfo ) if ( _preMeshInfo )
_preMeshInfo->ForgetOrLoad(); _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 * \brief Return groups cantained in _mapGroups by their IDs
@ -5968,6 +5987,9 @@ TListOfListOfInt SMESH_Mesh_i::findConcurrentSubMeshes()
mesh.SetMeshOrder( subMeshOrder ); mesh.SetMeshOrder( subMeshOrder );
res = true; res = true;
SMESH::SMESH_Mesh_var me = _this();
_gen_i->UpdateIcons( me );
return res; return res;
} }

View File

@ -396,8 +396,11 @@ public:
const char* theGroupName) const char* theGroupName)
throw (SALOME::SALOME_Exception); throw (SALOME::SALOME_Exception);
// ===================================================
// Internal methods not available through CORBA // Internal methods not available through CORBA
// They are called by corresponding interface methods // They are called by corresponding interface methods
// ===================================================
SMESH_Hypothesis::Hypothesis_Status addHypothesis(GEOM::GEOM_Object_ptr aSubShape, SMESH_Hypothesis::Hypothesis_Status addHypothesis(GEOM::GEOM_Object_ptr aSubShape,
SMESH::SMESH_Hypothesis_ptr anHyp, SMESH::SMESH_Hypothesis_ptr anHyp,
std::string* anErrorText=0); std::string* anErrorText=0);
@ -455,6 +458,16 @@ public:
*/ */
void CreateGroupServants(); 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 * \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. * happen if mesh data is not yet fully loaded from the file of study.
*/ */
bool IsMeshInfoCorrect(); bool IsMeshInfoCorrect();
/*! /*!
* Returns mesh unstructed grid information. * Returns mesh unstructed grid information.
*/ */
virtual SALOMEDS::TMPFile* GetVtkUgStream(); virtual SALOMEDS::TMPFile* GetVtkUgStream();
std::map<int, SMESH_subMesh_i*> _mapSubMesh_i; //NRI std::map<int, SMESH_subMesh_i*> _mapSubMesh_i; //NRI
std::map<int, ::SMESH_subMesh*> _mapSubMesh; //NRI std::map<int, ::SMESH_subMesh*> _mapSubMesh; //NRI

View File

@ -349,7 +349,6 @@ namespace SMESH
{ {
if ( CORBA::is_nil( theArg ) ) if ( CORBA::is_nil( theArg ) )
return *this << "None"; return *this << "None";
SMESH_Gen_i* aSMESHGen = SMESH_Gen_i::GetSMESHGen();
SALOMEDS::SObject_wrap aSObject = SMESH_Gen_i::ObjectToSObject(theArg); SALOMEDS::SObject_wrap aSObject = SMESH_Gen_i::ObjectToSObject(theArg);
if(!aSObject->_is_nil()) if(!aSObject->_is_nil())
{ {

View File

@ -21,7 +21,6 @@
# scripts / static # scripts / static
SET(_bin_SCRIPTS SET(_bin_SCRIPTS
smesh.py
ex00_all.py ex00_all.py
ex01_cube2build.py ex01_cube2build.py
ex02_cube2primitive.py ex02_cube2primitive.py

View File

@ -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!
===============================================================================
""")

View File

@ -1823,9 +1823,6 @@ class Mesh(metaclass = MeshMeta):
pass pass
if salome.sg.hasDesktop(): if salome.sg.hasDesktop():
if not isinstance( refresh, list): # not a call from subMesh.Compute() 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() if refresh: salome.sg.updateObjBrowser()
return ok return ok
@ -1971,9 +1968,6 @@ class Mesh(metaclass = MeshMeta):
self.mesh.Clear() self.mesh.Clear()
if ( salome.sg.hasDesktop() ): if ( salome.sg.hasDesktop() ):
smeshgui = salome.ImportComponentGUI("SMESH")
smeshgui.Init()
smeshgui.SetMeshIcon( salome.ObjectToID( self.mesh ), False, True )
if refresh: salome.sg.updateObjBrowser() if refresh: salome.sg.updateObjBrowser()
def ClearSubMesh(self, geomId, refresh=False): def ClearSubMesh(self, geomId, refresh=False):
@ -1987,9 +1981,6 @@ class Mesh(metaclass = MeshMeta):
self.mesh.ClearSubMesh(geomId) self.mesh.ClearSubMesh(geomId)
if salome.sg.hasDesktop(): if salome.sg.hasDesktop():
smeshgui = salome.ImportComponentGUI("SMESH")
smeshgui.Init()
smeshgui.SetMeshIcon( salome.ObjectToID( self.mesh ), False, True )
if refresh: salome.sg.updateObjBrowser() if refresh: salome.sg.updateObjBrowser()
def AutomaticTetrahedralization(self, fineness=0): def AutomaticTetrahedralization(self, fineness=0):
@ -6903,9 +6894,6 @@ class submeshProxy(SMESH._objref_SMESH_subMesh):
ok = self.mesh.Compute( self.GetSubShape(),refresh=[] ) ok = self.mesh.Compute( self.GetSubShape(),refresh=[] )
if salome.sg.hasDesktop(): if salome.sg.hasDesktop():
smeshgui = salome.ImportComponentGUI("SMESH")
smeshgui.Init()
smeshgui.SetMeshIcon( salome.ObjectToID( self ), ok, (self.GetNumberOfElements()==0) )
if refresh: salome.sg.updateObjBrowser() if refresh: salome.sg.updateObjBrowser()
pass pass

View File

@ -144,9 +144,9 @@ namespace
_PTR(Study) study = SMESH::getStudy(); _PTR(Study) study = SMESH::getStudy();
if ( study ) if ( study )
{ {
sobject = study->FindObjectID( uid ); sobject = study->FindObjectID( uid );
if ( !sobject ) if ( !sobject )
sobject = study->FindObjectIOR( uid ); sobject = study->FindObjectIOR( uid );
} }
} }
return sobject; return sobject;
@ -168,26 +168,26 @@ namespace
{ {
if ( uid ) if ( uid )
{ {
ViewManagerList vms = app->viewManagers(); ViewManagerList vms = app->viewManagers();
for ( int i = 0; i < vms.count() && !window; i++ ) for ( int i = 0; i < vms.count() && !window; i++ )
{ {
SUIT_ViewManager* vm = vms[i]; SUIT_ViewManager* vm = vms[i];
QVector<SUIT_ViewWindow*> vws = vm->getViews(); QVector<SUIT_ViewWindow*> vws = vm->getViews();
for ( int j = 0; j < vws.count() && !window; j++) for ( int j = 0; j < vws.count() && !window; j++)
{ {
SUIT_ViewWindow* vw = vws[0]; SUIT_ViewWindow* vw = vws[0];
if ( uid == vw->getId() ) if ( uid == vw->getId() )
window = dynamic_cast<SALOME_View*>( vm->getViewModel() ); window = dynamic_cast<SALOME_View*>( vm->getViewModel() );
} }
} }
} }
else else
{ {
SUIT_ViewManager* vm = app->getViewManager( SVTK_Viewer::Type(), create ); SUIT_ViewManager* vm = app->getViewManager( SVTK_Viewer::Type(), create );
if ( vm ) if ( vm )
{ {
window = dynamic_cast<SALOME_View*>( vm->getViewModel() ); window = dynamic_cast<SALOME_View*>( vm->getViewModel() );
} }
} }
} }
return window; return window;
@ -209,11 +209,11 @@ namespace
foreach( SUIT_ViewManager* vm, vms ) foreach( SUIT_ViewManager* vm, vms )
{ {
if ( vm && vm->getType() == SVTK_Viewer::Type() ) if ( vm && vm->getType() == SVTK_Viewer::Type() )
{ {
SALOME_View* view = dynamic_cast<SALOME_View*>( vm->getViewModel() ); SALOME_View* view = dynamic_cast<SALOME_View*>( vm->getViewModel() );
if ( view ) if ( view )
views << view; views << view;
} }
} }
} }
return views; return views;
@ -255,44 +255,44 @@ namespace
if ( actor ) if ( actor )
{ {
actor->GetNodeColor( props.nodeColor.r, actor->GetNodeColor( props.nodeColor.r,
props.nodeColor.g, props.nodeColor.g,
props.nodeColor.b ); props.nodeColor.b );
props.markerType = actor->GetMarkerType(); props.markerType = actor->GetMarkerType();
props.markerScale = actor->GetMarkerScale(); props.markerScale = actor->GetMarkerScale();
actor->GetEdgeColor( props.edgeColor.r, actor->GetEdgeColor( props.edgeColor.r,
props.edgeColor.g, props.edgeColor.g,
props.edgeColor.b ); props.edgeColor.b );
props.edgeWidth = qMax( (int)actor->GetLineWidth(), 1 ); props.edgeWidth = qMax( (int)actor->GetLineWidth(), 1 );
actor->GetSufaceColor( props.surfaceColor.r, actor->GetSufaceColor( props.surfaceColor.r,
props.surfaceColor.g, props.surfaceColor.g,
props.surfaceColor.b, props.surfaceColor.b,
props.surfaceColor.delta ); props.surfaceColor.delta );
actor->GetVolumeColor( props.volumeColor.r, actor->GetVolumeColor( props.volumeColor.r,
props.volumeColor.g, props.volumeColor.g,
props.volumeColor.b, props.volumeColor.b,
props.volumeColor.delta ); props.volumeColor.delta );
actor->Get0DColor( props.elem0dColor.r, actor->Get0DColor( props.elem0dColor.r,
props.elem0dColor.g, props.elem0dColor.g,
props.elem0dColor.b ); props.elem0dColor.b );
props.elem0dSize = qMax( (int)actor->Get0DSize(), 1 ); props.elem0dSize = qMax( (int)actor->Get0DSize(), 1 );
actor->GetBallColor( props.ballColor.r, actor->GetBallColor( props.ballColor.r,
props.ballColor.g, props.ballColor.g,
props.ballColor.b ); props.ballColor.b );
props.ballScale = qMax( actor->GetBallScale(), 1e-2 ); props.ballScale = qMax( actor->GetBallScale(), 1e-2 );
actor->GetOutlineColor( props.outlineColor.r, actor->GetOutlineColor( props.outlineColor.r,
props.outlineColor.g, props.outlineColor.g,
props.outlineColor.b ); props.outlineColor.b );
props.outlineWidth = qMax( (int)actor->GetOutlineWidth(), 1 ); props.outlineWidth = qMax( (int)actor->GetOutlineWidth(), 1 );
actor->GetFacesOrientationColor( props.orientationColor.r, actor->GetFacesOrientationColor( props.orientationColor.r,
props.orientationColor.g, props.orientationColor.g,
props.orientationColor.b ); props.orientationColor.b );
props.orientationScale = actor->GetFacesOrientationScale(); props.orientationScale = actor->GetFacesOrientationScale();
props.orientation3d = actor->GetFacesOrientation3DVectors(); props.orientation3d = actor->GetFacesOrientation3DVectors();
@ -316,44 +316,44 @@ namespace
if ( actor ) if ( actor )
{ {
actor->SetNodeColor( props.nodeColor.r, actor->SetNodeColor( props.nodeColor.r,
props.nodeColor.g, props.nodeColor.g,
props.nodeColor.b ); props.nodeColor.b );
if ( props.markerType != VTK::MT_USER ) if ( props.markerType != VTK::MT_USER )
actor->SetMarkerStd( props.markerType, props.markerScale ); actor->SetMarkerStd( props.markerType, props.markerScale );
actor->SetEdgeColor( props.edgeColor.r, actor->SetEdgeColor( props.edgeColor.r,
props.edgeColor.g, props.edgeColor.g,
props.edgeColor.b ); props.edgeColor.b );
actor->SetLineWidth( qMax( (double)props.edgeWidth, 1. ) ); actor->SetLineWidth( qMax( (double)props.edgeWidth, 1. ) );
actor->SetSufaceColor( props.surfaceColor.r, actor->SetSufaceColor( props.surfaceColor.r,
props.surfaceColor.g, props.surfaceColor.g,
props.surfaceColor.b, props.surfaceColor.b,
props.surfaceColor.delta ); props.surfaceColor.delta );
actor->SetVolumeColor( props.volumeColor.r, actor->SetVolumeColor( props.volumeColor.r,
props.volumeColor.g, props.volumeColor.g,
props.volumeColor.b, props.volumeColor.b,
props.volumeColor.delta ); props.volumeColor.delta );
actor->Set0DColor( props.elem0dColor.r, actor->Set0DColor( props.elem0dColor.r,
props.elem0dColor.g, props.elem0dColor.g,
props.elem0dColor.b ); props.elem0dColor.b );
actor->Set0DSize( qMax( (double)props.elem0dSize, 1. ) ); actor->Set0DSize( qMax( (double)props.elem0dSize, 1. ) );
actor->SetBallColor( props.ballColor.r, actor->SetBallColor( props.ballColor.r,
props.ballColor.g, props.ballColor.g,
props.ballColor.b ); props.ballColor.b );
actor->SetBallScale( qMax( props.ballScale, 1e-2 ) ); actor->SetBallScale( qMax( props.ballScale, 1e-2 ) );
actor->SetOutlineColor( props.outlineColor.r, actor->SetOutlineColor( props.outlineColor.r,
props.outlineColor.g, props.outlineColor.g,
props.outlineColor.b ); props.outlineColor.b );
actor->SetOutlineWidth( qMax( (double)props.outlineWidth, 1. ) ); actor->SetOutlineWidth( qMax( (double)props.outlineWidth, 1. ) );
actor->SetFacesOrientationColor( props.orientationColor.r, actor->SetFacesOrientationColor( props.orientationColor.r,
props.orientationColor.g, props.orientationColor.g,
props.orientationColor.b ); props.orientationColor.b );
actor->SetFacesOrientationScale( props.orientationScale ); actor->SetFacesOrientationScale( props.orientationScale );
actor->SetFacesOrientation3DVectors( props.orientation3d ); actor->SetFacesOrientation3DVectors( props.orientation3d );
@ -559,7 +559,7 @@ void SMESH_Swig::init()
SalomeApp_Application* app = dynamic_cast<SalomeApp_Application*>( session->activeApplication() ); SalomeApp_Application* app = dynamic_cast<SalomeApp_Application*>( session->activeApplication() );
if ( !SMESHGUI::GetSMESHGUI() ) 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 ) ) if ( !CORBA::is_nil( object ) )
{ {
SALOMEDS::SObject_var sobject = SALOMEDS::SObject_var sobject =
SMESHGUI::GetSMESHGen()->PublishInStudy( SALOMEDS::SObject::_nil(), SMESHGUI::GetSMESHGen()->PublishInStudy( SALOMEDS::SObject::_nil(),
object.in(), object.in(),
name ); name );
if ( !CORBA::is_nil( sobject ) ) if ( !CORBA::is_nil( sobject ) )
{ {
uid = sobject->GetID(); uid = sobject->GetID();
} }
sobject->UnRegister(); 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 SALOME_View* view = uid2wnd( myViewUid, true ); // create view if it's not present
if ( view ) 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 ) if ( myViewUid == -1 )
{ {
QList<SALOME_View*> views = windows(); QList<SALOME_View*> views = windows();
foreach( SALOME_View* view, views ) foreach( SALOME_View* view, views )
LightApp_Displayer::FindDisplayer( "Mesh", true )->Erase( myUid, true, myIsUpdate, view ); LightApp_Displayer::FindDisplayer( "Mesh", true )->Erase( myUid, true, myIsUpdate, view );
} }
else else
{ {
SALOME_View* view = uid2wnd( myViewUid ); SALOME_View* view = uid2wnd( myViewUid );
if ( view ) if ( view )
LightApp_Displayer::FindDisplayer( "Mesh", true )->Erase( myUid, true, myIsUpdate, 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() virtual void Execute()
{ {
Handle(SALOME_InteractiveObject) io = Handle(SALOME_InteractiveObject) io =
new SALOME_InteractiveObject( myUid, "SMESH", "" ); new SALOME_InteractiveObject( myUid, "SMESH", "" );
SMESH::Update( io, true ); SMESH::Update( io, true );
} }
}; };
@ -775,7 +775,7 @@ public:
QList<SALOME_View*> views = windows(); QList<SALOME_View*> views = windows();
foreach( SALOME_View* view, views ) foreach( SALOME_View* view, views )
{ {
setProperties( view, myUid, myProps ); setProperties( view, myUid, myProps );
} }
} }
else else
@ -867,7 +867,7 @@ public:
{ {
actor->SetPointsLabeled( myNumbering ); actor->SetPointsLabeled( myNumbering );
if ( view ) if ( view )
view->Repaint(); view->Repaint();
} }
} }
}; };
@ -954,7 +954,7 @@ public:
{ {
actor->SetCellsLabeled( myNumbering ); actor->SetCellsLabeled( myNumbering );
if ( view ) if ( view )
view->Repaint(); view->Repaint();
} }
} }
}; };
@ -1040,7 +1040,7 @@ public:
{ {
actor->SetRepresentation( myMode ); actor->SetRepresentation( myMode );
if ( view ) if ( view )
view->Repaint(); view->Repaint();
} }
} }
}; };
@ -1125,11 +1125,11 @@ public:
if ( actor ) if ( actor )
{ {
if ( myShrink ) if ( myShrink )
actor->SetShrink(); actor->SetShrink();
else else
actor->UnShrink(); actor->UnShrink();
if ( view ) if ( view )
view->Repaint(); view->Repaint();
} }
} }
}; };
@ -1215,7 +1215,7 @@ public:
{ {
actor->SetOpacity( myOpacity ); actor->SetOpacity( myOpacity );
if ( view ) if ( view )
view->Repaint(); view->Repaint();
} }
} }
}; };
@ -1301,7 +1301,7 @@ public:
{ {
actor->SetFacesOriented( myShown ); actor->SetFacesOriented( myShown );
if ( view ) if ( view )
view->Repaint(); view->Repaint();
} }
} }
}; };
@ -1387,7 +1387,7 @@ public:
{ {
actor->SetEntityMode( myEntities ); actor->SetEntityMode( myEntities );
if ( view ) 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* SMESH_Swig::AddSubMesh(const char* /*meshUid*/,
const char* ior, const char* ior,
int /*shapeType*/, int /*shapeType*/,
const char* name) const char* name)
{ {
deprecated("SMESH_Swig::AddSubMesh", "SMESH_Swig::publish"); deprecated("SMESH_Swig::AddSubMesh", "SMESH_Swig::publish");
return publish( ior, name ); return publish( ior, name );
@ -1597,7 +1597,7 @@ const char* SMESH_Swig::AddSubMeshOnShape(const char* /*meshUid*/,
const char* /*shapeUid*/, const char* /*shapeUid*/,
const char* ior, const char* ior,
int /*shapeType*/, int /*shapeType*/,
const char* name) const char* name)
{ {
deprecated("SMESH_Swig::AddSubMeshOnShape", "SMESH_Swig::publish"); deprecated("SMESH_Swig::AddSubMeshOnShape", "SMESH_Swig::publish");
return publish( ior, name ); return publish( ior, name );
@ -1887,7 +1887,7 @@ public:
{ {
SVTK_ViewWindow* vw = dynamic_cast<SVTK_ViewWindow*>( model->getViewManager()->getActiveView() ); SVTK_ViewWindow* vw = dynamic_cast<SVTK_ViewWindow*>( model->getViewManager()->getActiveView() );
if ( vw ) if ( vw )
myResult = (SelectionMode)vw->SelectionMode(); myResult = (SelectionMode)vw->SelectionMode();
} }
} }
}; };
@ -1925,25 +1925,25 @@ public:
SVTK_ViewWindow* vw = dynamic_cast<SVTK_ViewWindow*>( model->getViewManager()->getActiveView() ); SVTK_ViewWindow* vw = dynamic_cast<SVTK_ViewWindow*>( model->getViewManager()->getActiveView() );
if ( vw ) if ( vw )
{ {
SelectionMode previousMode = (SelectionMode)vw->SelectionMode(); SelectionMode previousMode = (SelectionMode)vw->SelectionMode();
bool switchPointMode = ( previousMode == Node && mySelectionMode != Node ) || bool switchPointMode = ( previousMode == Node && mySelectionMode != Node ) ||
( previousMode != Node && mySelectionMode == Node ); ( previousMode != Node && mySelectionMode == Node );
if ( switchPointMode ) if ( switchPointMode )
{ {
vtkRenderer* renderer = vw->getRenderer(); vtkRenderer* renderer = vw->getRenderer();
VTK::ActorCollectionCopy actors( renderer->GetActors() ); VTK::ActorCollectionCopy actors( renderer->GetActors() );
vtkActorCollection* collection = actors.GetActors(); vtkActorCollection* collection = actors.GetActors();
collection->InitTraversal(); collection->InitTraversal();
while ( vtkActor* vtkActor = collection->GetNextActor() ) while ( vtkActor* vtkActor = collection->GetNextActor() )
{ {
if ( SMESH_Actor* actor = dynamic_cast<SMESH_Actor*>( vtkActor ) ) if ( SMESH_Actor* actor = dynamic_cast<SMESH_Actor*>( vtkActor ) )
{ {
if ( actor->GetVisibility() ) if ( actor->GetVisibility() )
actor->SetPointRepresentation( mySelectionMode == Node ); actor->SetPointRepresentation( mySelectionMode == Node );
} }
} }
} }
vw->SetSelectionMode( mySelectionMode ); vw->SetSelectionMode( mySelectionMode );
} }
} }
} }