1 // Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 // SMESH SMESH : GUI for SMESH component
21 // File : libSMESH_Swig.cxx
22 // Author : Nicolas REJNERI, Open CASCADE S.A.S.
25 #include "libSMESH_Swig.h"
28 #include <SMESHGUI_Utils.h>
29 #include <SMESHGUI_Displayer.h>
31 // SALOME KERNEL includes
32 #include <Utils_ORB_INIT.hxx>
33 #include <Utils_SINGLETON.hxx>
34 #include <SALOMEDSClient_ClientFactory.hxx>
36 #include <utilities.h>
38 // SALOME GUI includes
39 #include <SUIT_Session.h>
40 #include <SUIT_ViewManager.h>
41 #include <SALOME_Prs.h>
42 #include <SUIT_ViewWindow.h>
43 #include <VTKViewer_ViewModel.h>
44 #include <SALOME_Event.h>
45 #include <SalomeApp_Application.h>
51 #include <QApplication>
54 #include <SALOMEconfig.h>
55 #include CORBA_SERVER_HEADER(SMESH_Gen)
56 #include CORBA_SERVER_HEADER(SMESH_Hypothesis)
58 static CORBA::ORB_var anORB;
62 //---------------------------------------------------------------
65 StringToObject(const std::string& theIOR)
67 return anORB->string_to_object(theIOR.c_str());
71 //---------------------------------------------------------------
74 GetDomainRoot(const SALOMEDS::SComponent_var& theSComponentMesh,
75 const SALOMEDS::StudyBuilder_var& theStudyBuilder,
76 CORBA::Long theDomainRootTag,
77 const QString& theName,
78 const QString& thePixmap)
80 SALOMEDS::SObject_var aDomainRoot;
81 if (!theSComponentMesh->FindSubObject(theDomainRootTag,aDomainRoot)) {
82 aDomainRoot = theStudyBuilder->NewObjectToTag(theSComponentMesh,theDomainRootTag);
83 SALOMEDS::GenericAttribute_var anAttr = theStudyBuilder->FindOrCreateAttribute(aDomainRoot,"AttributeName");
84 SALOMEDS::AttributeName_var aName = SALOMEDS::AttributeName::_narrow(anAttr);
85 aName->SetValue(theName.toLatin1().data());
87 anAttr = theStudyBuilder->FindOrCreateAttribute(aDomainRoot,"AttributePixMap");
88 SALOMEDS::AttributePixMap_var aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr);
89 aPixmap->SetPixMap(thePixmap.toLatin1().data());
90 aPixmap->UnRegister();
91 anAttr = theStudyBuilder->FindOrCreateAttribute(aDomainRoot,"AttributeSelectable");
92 SALOMEDS::AttributeSelectable_var aSelAttr = SALOMEDS::AttributeSelectable::_narrow(anAttr);
93 aSelAttr->SetSelectable(false);
94 aSelAttr->UnRegister();
101 //---------------------------------------------------------------
103 SALOMEDS::SObject_var
104 GetHypothesisRoot(const SALOMEDS::SComponent_var& theSComponentMesh,
105 const SALOMEDS::StudyBuilder_var& theStudyBuilder)
107 return GetDomainRoot(theSComponentMesh,
109 SMESH::Tag_HypothesisRoot,
110 QObject::tr("SMESH_MEN_HYPOTHESIS"),
111 "ICON_SMESH_TREE_HYPO");
115 //---------------------------------------------------------------
117 SALOMEDS::SObject_var
118 GetAlgorithmsRoot(const SALOMEDS::SComponent_var& theSComponentMesh,
119 const SALOMEDS::StudyBuilder_var& theStudyBuilder)
121 return GetDomainRoot(theSComponentMesh,
123 SMESH::Tag_AlgorithmsRoot,
124 QObject::tr("SMESH_MEN_ALGORITHMS"),
125 "ICON_SMESH_TREE_ALGO");
129 //---------------------------------------------------------------
131 SALOMEDS::SObject_var
132 AddToDomain(const std::string& theIOR,
133 const SALOMEDS::SComponent_var& theSComponentMesh,
134 const SALOMEDS::StudyBuilder_var& theStudyBuilder,
135 CORBA::Long theDomainRootTag,
136 const QString& theDomainName,
137 const QString& theDomainPixmap)
139 SALOMEDS::SObject_var aDomain = GetDomainRoot(theSComponentMesh,
141 SMESH::Tag_AlgorithmsRoot,
144 // Add New Hypothesis
145 SALOMEDS::SObject_var aSObject = theStudyBuilder->NewObject(aDomain);
146 aDomain->UnRegister();
147 SALOMEDS::GenericAttribute_var anAttr = theStudyBuilder->FindOrCreateAttribute(aSObject,"AttributePixMap");
148 SALOMEDS::AttributePixMap_var aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr);
149 CORBA::Object_var anObject = StringToObject(theIOR);
150 SMESH::SMESH_Hypothesis_var aDomainItem = SMESH::SMESH_Hypothesis::_narrow(anObject.in());
151 CORBA::String_var aType = aDomainItem->GetName();
152 QString aPixmapName = theDomainPixmap + "_" + aType.in();
153 aPixmap->SetPixMap(aPixmapName.toLatin1().data());
154 aPixmap->UnRegister();
155 anAttr = theStudyBuilder->FindOrCreateAttribute(aSObject,"AttributeIOR");
156 SALOMEDS::AttributeIOR_var anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
157 anIOR->SetValue(theIOR.c_str());
164 //---------------------------------------------------------------
165 SALOMEDS::SObject_var
166 AddHypothesis(const std::string& theIOR,
167 const SALOMEDS::SComponent_var& theSComponentMesh,
168 const SALOMEDS::StudyBuilder_var& theStudyBuilder)
170 return AddToDomain(theIOR,
173 SMESH::Tag_HypothesisRoot,
174 QObject::tr("SMESH_MEN_HYPOTHESIS"),
175 "ICON_SMESH_TREE_HYPO");
179 //---------------------------------------------------------------
180 SALOMEDS::SObject_var
181 AddAlgorithms(const std::string& theIOR,
182 const SALOMEDS::SComponent_var& theSComponentMesh,
183 const SALOMEDS::StudyBuilder_var& theStudyBuilder)
185 return AddToDomain(theIOR,
188 SMESH::Tag_AlgorithmsRoot,
189 QObject::tr("SMESH_MEN_ALGORITHMS"),
190 "ICON_SMESH_TREE_ALGO");
194 //---------------------------------------------------------------
196 SetDomain(const char* theMeshOrSubMeshEntry,
197 const char* theDomainEntry,
198 const SALOMEDS::Study_var& theStudy,
199 const SALOMEDS::StudyBuilder_var& theStudyBuilder,
200 long theRefOnAppliedDomainTag,
201 const QString& theAppliedDomainMEN,
202 const QString& theAppliedDomainICON)
204 SALOMEDS::SObject_var aMeshOrSubMeshSO = theStudy->FindObjectID(theMeshOrSubMeshEntry);
205 SALOMEDS::SObject_var aHypothesisSO = theStudy->FindObjectID(theDomainEntry);
207 if(!aMeshOrSubMeshSO->_is_nil() && !aHypothesisSO->_is_nil()){
208 //Find or Create Applied Hypothesis root
209 SALOMEDS::SObject_var anAppliedDomainSO;
210 if( !aMeshOrSubMeshSO->FindSubObject( theRefOnAppliedDomainTag, anAppliedDomainSO ))
212 anAppliedDomainSO = theStudyBuilder->NewObjectToTag(aMeshOrSubMeshSO,theRefOnAppliedDomainTag);
213 SALOMEDS::GenericAttribute_var anAttr =
214 theStudyBuilder->FindOrCreateAttribute(anAppliedDomainSO,"AttributeName");
215 SALOMEDS::AttributeName_var aName = SALOMEDS::AttributeName::_narrow(anAttr);
216 aName->SetValue(theAppliedDomainMEN.toLatin1().data());
218 anAttr = theStudyBuilder->FindOrCreateAttribute(anAppliedDomainSO,"AttributeSelectable");
219 SALOMEDS::AttributeSelectable_var aSelAttr = SALOMEDS::AttributeSelectable::_narrow(anAttr);
220 aSelAttr->SetSelectable(false);
221 aSelAttr->UnRegister();
222 anAttr = theStudyBuilder->FindOrCreateAttribute(anAppliedDomainSO,"AttributePixMap");
223 SALOMEDS::AttributePixMap_var aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr);
224 aPixmap->SetPixMap(theAppliedDomainICON.toLatin1().data());
225 aPixmap->UnRegister();
227 SALOMEDS::SObject_var aSObject = theStudyBuilder->NewObject(anAppliedDomainSO);
228 theStudyBuilder->Addreference(aSObject,aHypothesisSO);
229 aSObject->UnRegister();
230 anAppliedDomainSO->UnRegister();
232 if ( !aMeshOrSubMeshSO->_is_nil() ) aMeshOrSubMeshSO->UnRegister();
233 if ( !aHypothesisSO->_is_nil()) aHypothesisSO->UnRegister();
237 //---------------------------------------------------------------
239 SetHypothesis(const char* theMeshOrSubMeshEntry,
240 const char* theDomainEntry,
241 const SALOMEDS::Study_var& theStudy,
242 const SALOMEDS::StudyBuilder_var& theStudyBuilder)
244 SetDomain(theMeshOrSubMeshEntry,
248 SMESH::Tag_RefOnAppliedHypothesis,
249 QObject::tr("SMESH_MEN_APPLIED_HYPOTHESIS"),
250 "ICON_SMESH_TREE_HYPO");
254 //---------------------------------------------------------------
256 SetAlgorithms(const char* theMeshOrSubMeshEntry,
257 const char* theDomainEntry,
258 const SALOMEDS::Study_var& theStudy,
259 const SALOMEDS::StudyBuilder_var& theStudyBuilder)
261 SetDomain(theMeshOrSubMeshEntry,
265 SMESH::Tag_RefOnAppliedAlgorithms,
266 QObject::tr("SMESH_MEN_APPLIED_ALGORIHTMS"),
267 "ICON_SMESH_TREE_ALGO");
272 //===============================================================
273 SMESH_Swig::SMESH_Swig()
275 class TEvent: public SALOME_Event
277 CORBA::ORB_var& myORB;
280 TEvent(CORBA::ORB_var& theORB):
289 ORB_INIT &anORBInit = *SINGLETON_<ORB_INIT>::Instance();
290 ASSERT(SINGLETON_<ORB_INIT>::IsAlreadyExisting());
291 myORB = anORBInit( 0, 0 );
293 INFOS("internal error : orb not found");
298 MESSAGE("Constructeur");
300 if(CORBA::is_nil(anORB))
301 ProcessVoidEvent(new TEvent(anORB));
303 ASSERT(!CORBA::is_nil(anORB));
307 //===============================================================
309 SMESH_Swig::Init(int theStudyID)
311 class TEvent: public SALOME_Event
314 SALOMEDS::Study_var& myStudy;
315 SALOMEDS::StudyBuilder_var& myStudyBuilder;
316 SALOMEDS::SComponent_var& mySComponentMesh;
318 TEvent(int theStudyID,
319 SALOMEDS::Study_var& theStudy,
320 SALOMEDS::StudyBuilder_var& theStudyBuilder,
321 SALOMEDS::SComponent_var& theSComponentMesh):
322 myStudyID (theStudyID),
324 myStudyBuilder (theStudyBuilder),
325 mySComponentMesh(theSComponentMesh)
330 if ( !mySComponentMesh->_is_nil() ) mySComponentMesh->UnRegister();
337 SUIT_Session* aSession = SUIT_Session::session();
338 SUIT_Application* anApplication = aSession->activeApplication();
339 SalomeApp_Application* anApp = dynamic_cast<SalomeApp_Application*>(anApplication);
341 SALOME_NamingService* aNamingService = anApp->namingService();
342 CORBA::Object_var anObject = aNamingService->Resolve("/myStudyManager");
343 SALOMEDS::StudyManager_var aStudyMgr = SALOMEDS::StudyManager::_narrow(anObject);
344 myStudy = aStudyMgr->GetStudyByID(myStudyID);
346 SMESH::SMESH_Gen_var aSMESHGen = SMESHGUI::GetSMESHGen();
347 aSMESHGen->SetCurrentStudy( myStudy.in() );
349 myStudyBuilder = myStudy->NewBuilder();
351 SALOMEDS::GenericAttribute_var anAttr;
352 SALOMEDS::AttributeName_var aName;
353 SALOMEDS::AttributePixMap_var aPixmap;
355 SALOMEDS::SComponent_var aSComponent = myStudy->FindComponent("SMESH");
356 if ( aSComponent->_is_nil() )
358 bool aLocked = myStudy->GetProperties()->IsLocked();
360 myStudy->GetProperties()->SetLocked(false);
362 SMESHGUI* aSMESHGUI = SMESHGUI::GetSMESHGUI();
363 //SRN: BugID IPAL9186, load a SMESH gui if it hasn't been loaded
365 CAM_Module* aModule = anApp->module("Mesh");
367 aModule = anApp->loadModule("Mesh");
368 aSMESHGUI = dynamic_cast<SMESHGUI*>(aModule);
369 } //SRN: BugID IPAL9186: end of a fix
371 aSComponent = myStudyBuilder->NewComponent("SMESH");
373 anAttr = myStudyBuilder->FindOrCreateAttribute(aSComponent,"AttributeName");
374 aName = SALOMEDS::AttributeName::_narrow(anAttr);
375 aName->SetValue(aSMESHGUI->moduleName().toLatin1().data());
378 anAttr = myStudyBuilder->FindOrCreateAttribute(aSComponent,"AttributePixMap");
379 aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr);
380 aPixmap->SetPixMap( "ICON_OBJBROWSER_SMESH" );
381 aPixmap->UnRegister();
383 SALOMEDS::UseCaseBuilder_var useCaseBuilder = myStudy->GetUseCaseBuilder();
384 useCaseBuilder->SetRootCurrent();
385 useCaseBuilder->Append( aSComponent.in() );
387 myStudyBuilder->DefineComponentInstance(aSComponent,aSMESHGen);
389 myStudy->GetProperties()->SetLocked(true);
392 mySComponentMesh = SALOMEDS::SComponent::_narrow(aSComponent);
394 qApp->processEvents(); // Workaround for bug 12662
400 ProcessVoidEvent(new TEvent(theStudyID,
407 //===============================================================
408 SMESH_Swig::~SMESH_Swig()
410 MESSAGE("Destructeur");
414 //===============================================================
415 const char* SMESH_Swig::AddNewMesh(const char* theIOR)
417 MESSAGE("AddNewMesh");
419 // VSR: added temporarily - to be removed - objects are published automatically by engine
420 SALOMEDS::SObject_var aSObject = myStudy->FindObjectIOR(theIOR);
421 if (aSObject->_is_nil())
423 //Find or Create Hypothesis root
424 SALOMEDS::SObject_var hroot = GetHypothesisRoot(mySComponentMesh,myStudyBuilder);
425 SALOMEDS::SObject_var aroot = GetAlgorithmsRoot(mySComponentMesh,myStudyBuilder);
430 aSObject = myStudyBuilder->NewObject(mySComponentMesh);
431 SALOMEDS::GenericAttribute_var anAttr = myStudyBuilder->FindOrCreateAttribute(aSObject,"AttributePixMap");
432 SALOMEDS::AttributePixMap_var aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr);
433 aPixmap->SetPixMap( "ICON_SMESH_TREE_MESH" );
434 aPixmap->UnRegister();
436 anAttr = myStudyBuilder->FindOrCreateAttribute(aSObject, "AttributeIOR");
437 SALOMEDS::AttributeIOR_var anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
438 anIOR->SetValue(theIOR);
442 CORBA::String_var anEntry = aSObject->GetID();
443 aSObject->UnRegister();
445 return anEntry._retn();
449 //===============================================================
450 const char* SMESH_Swig::AddNewHypothesis(const char* theIOR)
452 MESSAGE("AddNewHypothesis");
454 SALOMEDS::SObject_var aSObject = ::AddHypothesis(theIOR,
457 CORBA::String_var anEntry = aSObject->GetID();
458 aSObject->UnRegister();
460 return anEntry._retn();
464 //===============================================================
465 const char* SMESH_Swig::AddNewAlgorithms(const char* theIOR)
467 MESSAGE("AddNewAlgorithms");
469 SALOMEDS::SObject_var aSObject = ::AddAlgorithms(theIOR,
472 CORBA::String_var anEntry = aSObject->GetID();
473 aSObject->UnRegister();
475 return anEntry._retn();
479 //===============================================================
480 void SMESH_Swig::SetShape(const char* theShapeEntry,
481 const char* theMeshEntry)
483 SALOMEDS::SObject_var aGeomShapeSO = myStudy->FindObjectID( theShapeEntry );
484 SALOMEDS::SObject_var aMeshSO = myStudy->FindObjectID( theMeshEntry );
486 if(!aMeshSO->_is_nil() && !aGeomShapeSO->_is_nil()){
487 SALOMEDS::SObject_var aSObject = myStudyBuilder->NewObjectToTag(aMeshSO, SMESH::Tag_RefOnShape);
488 myStudyBuilder->Addreference(aSObject,aGeomShapeSO);
489 aSObject->UnRegister();
491 if ( !aMeshSO->_is_nil() ) aMeshSO->UnRegister();
492 if ( !aGeomShapeSO->_is_nil() ) aGeomShapeSO->UnRegister();
496 //===============================================================
497 void SMESH_Swig::SetHypothesis(const char* theMeshOrSubMeshEntry,
498 const char* theDomainEntry)
500 ::SetHypothesis(theMeshOrSubMeshEntry,
507 //===============================================================
508 void SMESH_Swig::SetAlgorithms(const char* theMeshOrSubMeshEntry,
509 const char* theDomainEntry)
511 ::SetAlgorithms(theMeshOrSubMeshEntry,
518 //===============================================================
520 SMESH_Swig::UnSetHypothesis(const char* theDomainEntry)
522 SALOMEDS::SObject_var aDomainSO = myStudy->FindObjectID(theDomainEntry);
523 if(!aDomainSO->_is_nil())
524 myStudyBuilder->RemoveObject(aDomainSO);
527 const char* SMESH_Swig::AddSubMesh(const char* theMeshEntry,
528 const char* theSubMeshIOR,
531 SALOMEDS::SObject_var aMeshSO = myStudy->FindObjectID(theMeshEntry);
532 if(!aMeshSO->_is_nil()) {
534 QString aSubMeshName;
535 switch(theShapeType) {
537 aShapeTag = SMESH::Tag_SubMeshOnSolid;
538 aSubMeshName = QObject::tr("SMESH_MEN_SubMeshesOnSolid");
541 aShapeTag = SMESH::Tag_SubMeshOnFace;
542 aSubMeshName = QObject::tr("SMESH_MEN_SubMeshesOnFace");
545 aShapeTag = SMESH::Tag_SubMeshOnEdge;
546 aSubMeshName = QObject::tr("SMESH_MEN_SubMeshesOnEdge");
549 aShapeTag = SMESH::Tag_SubMeshOnVertex;
550 aSubMeshName = QObject::tr("SMESH_MEN_SubMeshesOnVertex");
553 aShapeTag = SMESH::Tag_SubMeshOnCompound;
554 aSubMeshName = QObject::tr("SMESH_MEN_SubMeshesOnCompound");
557 SALOMEDS::GenericAttribute_var anAttr;
558 SALOMEDS::SObject_var aSubMeshesRoot;
559 if ( !aMeshSO->FindSubObject( aShapeTag, aSubMeshesRoot ) )
561 aSubMeshesRoot = myStudyBuilder->NewObjectToTag(aMeshSO,aShapeTag);
562 anAttr = myStudyBuilder->FindOrCreateAttribute(aSubMeshesRoot,"AttributeName");
563 SALOMEDS::AttributeName_var aName = SALOMEDS::AttributeName::_narrow(anAttr);
564 aName->SetValue(aSubMeshName.toLatin1().data());
566 anAttr = myStudyBuilder->FindOrCreateAttribute(aSubMeshesRoot,"AttributeSelectable");
567 SALOMEDS::AttributeSelectable_var aSelAttr = SALOMEDS::AttributeSelectable::_narrow(anAttr);
568 aSelAttr->SetSelectable(false);
569 aSelAttr->UnRegister();
571 aSubMeshesRoot->UnRegister();
572 aMeshSO->UnRegister();
574 SALOMEDS::SObject_var aSObject = myStudyBuilder->NewObject(aSubMeshesRoot);
575 anAttr = myStudyBuilder->FindOrCreateAttribute(aSObject,"AttributeIOR");
576 SALOMEDS::AttributeIOR_var anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
577 anIOR->SetValue(theSubMeshIOR);
580 CORBA::String_var aString = aSObject->GetID();
581 aSObject->UnRegister();
583 return aString._retn();
589 const char* SMESH_Swig::AddSubMeshOnShape(const char* theMeshEntry,
590 const char* theGeomShapeEntry,
591 const char* theSubMeshIOR,
594 SALOMEDS::SObject_var aGeomShapeSO = myStudy->FindObjectID(theGeomShapeEntry);
595 if(!aGeomShapeSO->_is_nil())
597 const char * aSubMeshEntry = AddSubMesh(theMeshEntry,theSubMeshIOR,ShapeType);
598 SALOMEDS::SObject_var aSubMeshSO = myStudy->FindObjectID(aSubMeshEntry);
599 if ( !aSubMeshSO->_is_nil()) {
600 SetShape( theGeomShapeEntry, aSubMeshEntry );
601 CORBA::String_var aString = aSubMeshSO->GetID();
602 aSubMeshSO->UnRegister();
603 return aString._retn();
605 aGeomShapeSO->UnRegister();
611 void SMESH_Swig::CreateAndDisplayActor( const char* Mesh_Entry )
613 // SMESH_Actor* Mesh = smeshGUI->ReadScript(aM);
614 class TEvent: public SALOME_Event
619 TEvent(const char* Mesh_Entry) {
622 virtual void Execute() {
623 //SMESH::UpdateView(SMESH::eDisplay, _entry);
624 SUIT_Session* aSession = SUIT_Session::session();
625 SUIT_Application* anApplication = aSession->activeApplication();
626 SalomeApp_Application* anApp = dynamic_cast<SalomeApp_Application*>(anApplication);
627 /*SUIT_ViewManager* vman = */anApp->getViewManager(VTKViewer_Viewer::Type(),true);
628 SMESHGUI_Displayer* aDisp = new SMESHGUI_Displayer(anApp);
629 aDisp->Display(_entry,1);
633 ProcessVoidEvent(new TEvent(Mesh_Entry));
636 void SMESH_Swig::EraseActor( const char* Mesh_Entry, const bool allViewers )
638 class TEvent: public SALOME_Event
644 TEvent(const char* Mesh_Entry, const bool allViewers ) {
646 _allViewers = allViewers;
648 virtual void Execute() {
649 SUIT_Session* aSession = SUIT_Session::session();
650 SUIT_Application* anApplication = aSession->activeApplication();
651 SalomeApp_Application* anApp = dynamic_cast<SalomeApp_Application*>(anApplication);
652 SMESHGUI_Displayer* aDisp = new SMESHGUI_Displayer(anApp);
653 ViewManagerList aManagers;
654 if ( !_allViewers ) {
655 aManagers << anApp->activeViewManager();
658 aManagers = anApp->viewManagers();
660 foreach( SUIT_ViewManager* aMgr, aManagers ) {
661 if ( aMgr && aMgr->getType() == VTKViewer_Viewer::Type() ) {
662 SALOME_View* aSalomeView = dynamic_cast<SALOME_View*>(aMgr->getViewModel());
664 aDisp->Erase(_entry,true, true, aSalomeView);
671 ProcessVoidEvent(new TEvent(Mesh_Entry, allViewers));
674 void SMESH_Swig::SetName(const char* theEntry,
677 SALOMEDS::SObject_var aSObject = myStudy->FindObjectID(theEntry);
678 SALOMEDS::GenericAttribute_var anAttr;
679 SALOMEDS::AttributeName_var aName;
680 if(!aSObject->_is_nil()){
681 anAttr = myStudyBuilder->FindOrCreateAttribute(aSObject,"AttributeName");
682 aName = SALOMEDS::AttributeName::_narrow(anAttr);
683 aName->SetValue(theName);
685 aSObject->UnRegister();
689 //================================================================================
691 * \brief Set mesh icon according to compute status
692 * \param Mesh_Entry - entry of a mesh
693 * \param isComputed - is mesh computed or not
695 //================================================================================
697 void SMESH_Swig::SetMeshIcon(const char* theMeshEntry,
698 const bool theIsComputed,
701 class TEvent: public SALOME_Event
703 SALOMEDS::Study_var myStudy;
704 std::string myMeshEntry;
705 bool myIsComputed, myIsEmpty;
707 TEvent(const SALOMEDS::Study_var& theStudy,
708 const std::string& theMeshEntry,
709 const bool theIsComputed,
712 myMeshEntry (theMeshEntry),
713 myIsComputed(theIsComputed),
721 SALOMEDS::SObject_ptr aMeshSO = myStudy->FindObjectID(myMeshEntry.c_str());
722 if(_PTR(SObject) aMesh = ClientFactory::SObject(aMeshSO))
723 SMESH::ModifiedMesh(aMesh,myIsComputed,myIsEmpty);
724 // aMeshSO->UnRegister(); ~aMesh() already called UnRegister()!
728 ProcessVoidEvent(new TEvent(myStudy,