X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=blobdiff_plain;f=src%2FSMESH_SWIG_WITHIHM%2FlibSMESH_Swig.cxx;h=b15711998a4edb82d98cb10eaecf5325d9ce5eb9;hp=99a36989769693b8e6696b03b2ea30a7a88a5fc9;hb=34a8a37aeeeda95e0e2dad6cdf51b45bbde5cbb8;hpb=9374764094357ba4a753d4040bfbd9dcb19343e0 diff --git a/src/SMESH_SWIG_WITHIHM/libSMESH_Swig.cxx b/src/SMESH_SWIG_WITHIHM/libSMESH_Swig.cxx index 99a369897..b15711998 100644 --- a/src/SMESH_SWIG_WITHIHM/libSMESH_Swig.cxx +++ b/src/SMESH_SWIG_WITHIHM/libSMESH_Swig.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CADE +// Copyright (C) 2007-2021 CEA/DEN, EDF R&D, OPEN CASCADE // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -37,7 +37,7 @@ /// may only be needed to be called in case if mesh objects are /// created when no active study is set to %SMESH component. /// In this case, mentioned functions can be used to forcibly -/// publish existing objects in the currrently active study. +/// publish existing objects in the currently active study. /// /// Note that if there are no open study, these methods will do /// nothing. @@ -133,22 +133,20 @@ namespace /////////////////////////////////////////////////////////////// /// \internal /// \brief Get study object by its study UID or IOR. - /// \param studyId Study UID. /// \param uid Object's study UID or IOR. /// \return Pointer to study object (null object if it isn't /// found). /////////////////////////////////////////////////////////////// - _PTR(SObject) uid2object(int studyId, const std::string& uid) + _PTR(SObject) uid2object(const std::string& uid) { _PTR(SObject) sobject; - if ( studyId > 0 ) { - _PTR(Study) study = SalomeApp_Application::studyMgr()->GetStudyByID( studyId ); + _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; @@ -170,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; @@ -211,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; @@ -257,49 +255,49 @@ 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(); - + props.shrinkFactor = actor->GetShrinkFactor(); - + props.opacity = actor->GetOpacity(); } return props; @@ -318,51 +316,51 @@ 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 ); - + actor->SetShrinkFactor( props.shrinkFactor ); - + actor->SetOpacity( props.opacity ); - + view->Repaint(); } } @@ -534,7 +532,6 @@ Properties::Properties() /// \brief Constructor. ///////////////////////////////////////////////////////////////// SMESH_Swig::SMESH_Swig() - : myCachedStudyId( 0 ) { init(); } @@ -562,28 +559,15 @@ void SMESH_Swig::init() SalomeApp_Application* app = dynamic_cast( session->activeApplication() ); if ( !SMESHGUI::GetSMESHGUI() ) - app->loadModule( "Mesh" ); + app->loadModule( "Mesh" ); } }; // load SMESH GUI if it's not yet loaded - ProcessVoidEvent( new TInitEvent() ); - - // set current study - std::vector studies = SalomeApp_Application::studyMgr()->GetOpenStudies(); - if ( studies.size() > 0 ) - { - _PTR(Study) study = SalomeApp_Application::studyMgr()->GetStudyByName( studies[0] ); - int studyId = study->StudyId(); - if ( myCachedStudyId != studyId ) - { - myCachedStudyId = studyId; - SMESHGUI::GetSMESHGen()->SetCurrentStudy( _CAST(Study, study)->GetStudy() ); - } - } - else + if ( SUIT_Session::session() ) { - myCachedStudyId = 0; + ProcessVoidEvent( new TInitEvent() ); + SMESHGUI::GetSMESHGen()->UpdateStudy(); } } @@ -599,25 +583,19 @@ const char* SMESH_Swig::publish(const char* ior, const char* name) init(); std::string uid; - - if ( myCachedStudyId > 0 ) - { - _PTR(Study) study = SalomeApp_Application::studyMgr()->GetStudyByID( myCachedStudyId ); - CORBA::Object_var object = string2object( ior ); - if ( study && !CORBA::is_nil( object ) ) + CORBA::Object_var object = string2object( ior ); + if ( !CORBA::is_nil( object ) ) { SALOMEDS::SObject_var sobject = - SMESHGUI::GetSMESHGen()->PublishInStudy( _CAST(Study, study)->GetStudy(), - 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(); } - } return strdup( uid.c_str() ); } @@ -631,7 +609,7 @@ void SMESH_Swig::rename(const char* uid, const char* name) { init(); - _PTR(SObject) sobject = uid2object( myCachedStudyId, uid ); + _PTR(SObject) sobject = uid2object( uid ); if ( sobject ) sobject->SetAttrString( "AttributeName", name ); } @@ -659,13 +637,13 @@ 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 ); } }; init(); - _PTR(SObject) sobject = uid2object( myCachedStudyId, uid ); + _PTR(SObject) sobject = uid2object( uid ); if ( sobject ) ProcessVoidEvent( new TDisplayEvent( sobject->GetID().c_str(), viewUid, updateViewer ) ); } @@ -693,22 +671,22 @@ 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 ); } } }; init(); - _PTR(SObject) sobject = uid2object( myCachedStudyId, uid ); + _PTR(SObject) sobject = uid2object( uid ); if ( sobject ) ProcessVoidEvent( new TEraseEvent( sobject->GetID().c_str(), viewUid, updateViewer ) ); } @@ -727,15 +705,15 @@ void SMESH_Swig::update(const char* uid) TUpdateEvent( const char* uid ) : myUid( uid ) {} virtual void Execute() { - Handle(SALOME_InteractiveObject) io = - new SALOME_InteractiveObject( myUid, "SMESH", "" ); + Handle(SALOME_InteractiveObject) io = + new SALOME_InteractiveObject( myUid, "SMESH", "" ); SMESH::Update( io, true ); } }; init(); - _PTR(SObject) sobject = uid2object( myCachedStudyId, uid ); + _PTR(SObject) sobject = uid2object( uid ); if ( sobject ) ProcessVoidEvent( new TUpdateEvent( uid ) ); } @@ -773,7 +751,7 @@ Properties SMESH_Swig::properties(const char* uid, int viewUid) init(); - _PTR(SObject) sobject = uid2object( myCachedStudyId, uid ); + _PTR(SObject) sobject = uid2object( uid ); if ( sobject ) props = ProcessEvent( new TGetPropsEvent( sobject->GetID().c_str(), viewUid ) ); @@ -800,7 +778,7 @@ public: QList views = windows(); foreach( SALOME_View* view, views ) { - setProperties( view, myUid, myProps ); + setProperties( view, myUid, myProps ); } } else @@ -822,7 +800,7 @@ void SMESH_Swig::setProperties(const char* uid, const Properties& props, int vie { init(); - _PTR(SObject) sobject = uid2object( myCachedStudyId, uid ); + _PTR(SObject) sobject = uid2object( uid ); if ( sobject ) ProcessVoidEvent( new TSetPropsEvent( sobject->GetID().c_str(), props, viewUid ) ); } @@ -864,7 +842,7 @@ bool SMESH_Swig::nodesNumbering(const char* uid, int viewUid) init(); - _PTR(SObject) sobject = uid2object( myCachedStudyId, uid ); + _PTR(SObject) sobject = uid2object( uid ); if ( sobject ) numbering = ProcessEvent( new TGetNodeNumberingEvent( sobject->GetID().c_str(), viewUid ) ); @@ -892,7 +870,7 @@ public: { actor->SetPointsLabeled( myNumbering ); if ( view ) - view->Repaint(); + view->Repaint(); } } }; @@ -909,7 +887,7 @@ void SMESH_Swig::setNodesNumbering(const char* uid, bool numbering, int viewUid) { init(); - _PTR(SObject) sobject = uid2object( myCachedStudyId, uid ); + _PTR(SObject) sobject = uid2object( uid ); if ( sobject ) ProcessVoidEvent( new TSetNodeNumberingEvent( sobject->GetID().c_str(), numbering, viewUid ) ); } @@ -951,7 +929,7 @@ bool SMESH_Swig::elementsNumbering(const char* uid, int viewUid) init(); - _PTR(SObject) sobject = uid2object( myCachedStudyId, uid ); + _PTR(SObject) sobject = uid2object( uid ); if ( sobject ) numbering = ProcessEvent( new TGetElementNumberingEvent( sobject->GetID().c_str(), viewUid ) ); @@ -979,7 +957,7 @@ public: { actor->SetCellsLabeled( myNumbering ); if ( view ) - view->Repaint(); + view->Repaint(); } } }; @@ -996,7 +974,7 @@ void SMESH_Swig::setElementsNumbering(const char* uid, bool numbering, int viewU { init(); - _PTR(SObject) sobject = uid2object( myCachedStudyId, uid ); + _PTR(SObject) sobject = uid2object( uid ); if ( sobject ) ProcessVoidEvent( new TSetElementNumberingEvent( sobject->GetID().c_str(), numbering, viewUid ) ); } @@ -1037,7 +1015,7 @@ DisplayMode SMESH_Swig::displayMode(const char* uid, int viewUid) init(); - _PTR(SObject) sobject = uid2object( myCachedStudyId, uid ); + _PTR(SObject) sobject = uid2object( uid ); if ( sobject ) mode = ProcessEvent( new TGetDisplayModeEvent( sobject->GetID().c_str(), viewUid ) ); @@ -1065,7 +1043,7 @@ public: { actor->SetRepresentation( myMode ); if ( view ) - view->Repaint(); + view->Repaint(); } } }; @@ -1081,7 +1059,7 @@ void SMESH_Swig::setDisplayMode(const char* uid, DisplayMode mode, int viewUid) { init(); - _PTR(SObject) sobject = uid2object( myCachedStudyId, uid ); + _PTR(SObject) sobject = uid2object( uid ); if ( sobject ) ProcessVoidEvent( new TSetDisplayModeEvent( sobject->GetID().c_str(), mode, viewUid ) ); } @@ -1123,7 +1101,7 @@ bool SMESH_Swig::shrinkMode(const char* uid, int viewUid) init(); - _PTR(SObject) sobject = uid2object( myCachedStudyId, uid ); + _PTR(SObject) sobject = uid2object( uid ); if ( sobject ) shrinkMode = ProcessEvent( new TGetShrinkModeEvent( sobject->GetID().c_str(), viewUid ) ); @@ -1150,11 +1128,11 @@ public: if ( actor ) { if ( myShrink ) - actor->SetShrink(); + actor->SetShrink(); else - actor->UnShrink(); + actor->UnShrink(); if ( view ) - view->Repaint(); + view->Repaint(); } } }; @@ -1171,7 +1149,7 @@ void SMESH_Swig::setShrinkMode(const char* uid, bool shrink, int viewUid) { init(); - _PTR(SObject) sobject = uid2object( myCachedStudyId, uid ); + _PTR(SObject) sobject = uid2object( uid ); if ( sobject ) ProcessVoidEvent( new TSetShrinkModeEvent( sobject->GetID().c_str(), shrink, viewUid ) ); } @@ -1212,7 +1190,7 @@ double SMESH_Swig::opacity(const char* uid, int viewUid) init(); - _PTR(SObject) sobject = uid2object( myCachedStudyId, uid ); + _PTR(SObject) sobject = uid2object( uid ); if ( sobject ) opacity = ProcessEvent( new TGetOpacityEvent( sobject->GetID().c_str(), viewUid ) ); @@ -1240,7 +1218,7 @@ public: { actor->SetOpacity( myOpacity ); if ( view ) - view->Repaint(); + view->Repaint(); } } }; @@ -1256,7 +1234,7 @@ void SMESH_Swig::setOpacity(const char* uid, double opacity, int viewUid) { init(); - _PTR(SObject) sobject = uid2object( myCachedStudyId, uid ); + _PTR(SObject) sobject = uid2object( uid ); if ( sobject ) ProcessVoidEvent( new TSetOpacityEvent( sobject->GetID().c_str(), opacity, viewUid ) ); } @@ -1298,7 +1276,7 @@ bool SMESH_Swig::isOrientationShown(const char* uid, int viewUid) init(); - _PTR(SObject) sobject = uid2object( myCachedStudyId, uid ); + _PTR(SObject) sobject = uid2object( uid ); if ( sobject ) shown = ProcessEvent( new TGetOrientationEvent( sobject->GetID().c_str(), viewUid ) ); @@ -1326,7 +1304,7 @@ public: { actor->SetFacesOriented( myShown ); if ( view ) - view->Repaint(); + view->Repaint(); } } }; @@ -1343,7 +1321,7 @@ void SMESH_Swig::setOrientationShown(const char* uid, bool shown, int viewUid) { init(); - _PTR(SObject) sobject = uid2object( myCachedStudyId, uid ); + _PTR(SObject) sobject = uid2object( uid ); if ( sobject ) ProcessVoidEvent( new TSetOrientationEvent( sobject->GetID().c_str(), shown, viewUid ) ); } @@ -1384,7 +1362,7 @@ int SMESH_Swig::entitiesShown(const char* uid, int viewUid) init(); - _PTR(SObject) sobject = uid2object( myCachedStudyId, uid ); + _PTR(SObject) sobject = uid2object( uid ); if ( sobject ) entities = ProcessEvent( new TGetEntitiesEvent( sobject->GetID().c_str(), viewUid ) ); @@ -1412,7 +1390,7 @@ public: { actor->SetEntityMode( myEntities ); if ( view ) - view->Repaint(); + view->Repaint(); } } }; @@ -1428,7 +1406,7 @@ void SMESH_Swig::setEntitiesShown(const char* uid, int entities, int viewUid) { init(); - _PTR(SObject) sobject = uid2object( myCachedStudyId, uid ); + _PTR(SObject) sobject = uid2object( uid ); if ( sobject ) ProcessVoidEvent( new TSetEntitiesEvent( sobject->GetID().c_str(), entities, viewUid ) ); } @@ -1447,7 +1425,7 @@ bool SMESH_Swig::isEntityShown(const char* uid, EntityMode entity, int viewUid) init(); - _PTR(SObject) sobject = uid2object( myCachedStudyId, uid ); + _PTR(SObject) sobject = uid2object( uid ); if ( sobject ) { int entities = ProcessEvent( new TGetEntitiesEvent( sobject->GetID().c_str(), viewUid ) ); @@ -1469,7 +1447,7 @@ void SMESH_Swig::setEntityShown(const char* uid, EntityMode entity, bool show, i { init(); - _PTR(SObject) sobject = uid2object( myCachedStudyId, uid ); + _PTR(SObject) sobject = uid2object( uid ); if ( sobject ) { int entities = ProcessEvent( new TGetEntitiesEvent( sobject->GetID().c_str(), viewUid ) ); @@ -1484,9 +1462,8 @@ void SMESH_Swig::setEntityShown(const char* uid, EntityMode entity, bool show, i ///////////////////////////////////////////////////////////////// /// \brief Initialize %SMESH GUI Python interface. /// \deprecated Interface is initialized automatically. -/// \param studyID Study UID (not used). ///////////////////////////////////////////////////////////////// -void SMESH_Swig::Init(int /*studyID*/) +void SMESH_Swig::Init() { deprecated("SMESH_Swig::Init"); // does nothing; initialization is done automatically. @@ -1533,7 +1510,7 @@ const char* SMESH_Swig::AddNewAlgorithm(const char* ior, const char* name) ///////////////////////////////////////////////////////////////// /// \deprecated Publishing is done automatically. -/// \deprecated Synonim of AddNewAlgorithm(). +/// \deprecated Synonym of AddNewAlgorithm(). /// \param ior IOR of the algorithm. /// \param name Name of the algorithm (optional). /// \return UID of the data object. @@ -1603,7 +1580,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 ); @@ -1623,7 +1600,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 ); @@ -1742,7 +1719,7 @@ public: if ( !selMgr ) return; - + selMgr->clearFilters(); SVTK_ViewWindow* vw = SMESH::GetViewWindow(); @@ -1750,10 +1727,10 @@ public: return; SMESH_Actor* actor = SMESH::FindActorByEntry( myUid ); - + if ( !actor || !actor->hasIO() ) return; - + Handle(SALOME_InteractiveObject) io = actor->getIO(); SALOME_ListIO ios; ios.Append( io ); @@ -1761,7 +1738,7 @@ public: if ( vw->SelectionMode() == ActorSelection ) return; - + TColStd_MapOfInteger idMap; std::vector::const_iterator it; for ( it = myIds.begin(); it != myIds.end(); ++it ) @@ -1789,11 +1766,11 @@ void SMESH_Swig::select(const char* uid, std::vector ids, bool append) { init(); - _PTR(SObject) sobject = uid2object( myCachedStudyId, uid ); + _PTR(SObject) sobject = uid2object( uid ); if ( sobject ) ProcessVoidEvent( new TSelectListEvent( sobject->GetID().c_str(), ids, append ) ); } - + ///////////////////////////////////////////////////////////////// /// \brief Select element of the mesh, sub-mesh or group. /// \param uid Mesh object's study UID or IOR. @@ -1809,7 +1786,7 @@ void SMESH_Swig::select(const char* uid, int id, bool append) std::vector ids; ids.push_back( id ); - _PTR(SObject) sobject = uid2object( myCachedStudyId, uid ); + _PTR(SObject) sobject = uid2object( uid ); if ( sobject ) ProcessVoidEvent( new TSelectListEvent( sobject->GetID().c_str(), ids, append ) ); } @@ -1837,7 +1814,7 @@ public: if ( !selMgr ) return; - + selMgr->clearFilters(); SVTK_ViewWindow* vw = SMESH::GetViewWindow(); @@ -1845,10 +1822,10 @@ public: return; SMESH_Actor* actor = SMESH::FindActorByEntry( myUid ); - + if ( !actor || !actor->hasIO() ) return; - + Handle(SALOME_InteractiveObject) io = actor->getIO(); SALOME_ListIO ios; ios.Append( io ); @@ -1856,7 +1833,7 @@ public: if ( vw->SelectionMode() != EdgeOfCellSelection ) return; - + SVTK_IndexedMapOfIds idMap; std::vector >::const_iterator it; for ( it = myIds.begin(); it != myIds.end(); ++it ) @@ -1888,7 +1865,7 @@ void SMESH_Swig::select(const char* uid, std::vector > ids, b { init(); - _PTR(SObject) sobject = uid2object( myCachedStudyId, uid ); + _PTR(SObject) sobject = uid2object( uid ); if ( sobject ) ProcessVoidEvent( new TSelectListOfPairEvent( sobject->GetID().c_str(), ids, append ) ); } @@ -1913,7 +1890,7 @@ public: { SVTK_ViewWindow* vw = dynamic_cast( model->getViewManager()->getActiveView() ); if ( vw ) - myResult = (SelectionMode)vw->SelectionMode(); + myResult = (SelectionMode)vw->SelectionMode(); } } }; @@ -1951,25 +1928,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 ); } } } @@ -1984,7 +1961,7 @@ public: void SMESH_Swig::setSelectionMode(SelectionMode mode, int viewUid) { init(); - ProcessVoidEvent( new TSetSelectionModeEvent( mode, viewUid ) ); + ProcessVoidEvent( new TSetSelectionModeEvent( mode, viewUid ) ); } ///////////////////////////////////////////////////////////////// @@ -1996,17 +1973,17 @@ public: typedef std::vector TResult; TResult myResult; const char* myUid; - + TGetSelectedEvent( const char* uid ) : myUid( uid ) {} - + virtual void Execute() { SVTK_ViewWindow* vw = SMESH::GetViewWindow(); if ( !vw ) return; - SVTK_Selector* selector = vw->GetSelector(); + SVTK_Selector* selector = vw->GetSelector(); if ( !selector ) return; @@ -2033,7 +2010,7 @@ std::vector SMESH_Swig::getSelected(const char* uid) init(); - _PTR(SObject) sobject = uid2object( myCachedStudyId, uid ); + _PTR(SObject) sobject = uid2object( uid ); if ( sobject ) ids = ProcessEvent( new TGetSelectedEvent( sobject->GetID().c_str() ) ); @@ -2049,10 +2026,10 @@ public: typedef std::vector > TResult; TResult myResult; const char* myUid; - + TGetSelectedPairEvent( const char* uid ) : myUid( uid ) {} - + virtual void Execute() { SVTK_ViewWindow* vw = SMESH::GetViewWindow(); @@ -2062,7 +2039,7 @@ public: if ( vw->SelectionMode() != EdgeOfCellSelection ) return; - SVTK_Selector* selector = vw->GetSelector(); + SVTK_Selector* selector = vw->GetSelector(); if ( !selector ) return; @@ -2073,8 +2050,9 @@ public: SVTK_IndexedMapOfIds idMap; selector->GetCompositeIndex( actor->getIO(), idMap ); - for ( int i = 1; i <= idMap.Extent(); i++ ) - myResult.push_back( std::make_pair( (int)idMap( i )[0], (int)idMap( i )[1]) ); + for ( int i = 1; i <= idMap.Extent(); i++ ) { + myResult.push_back( std::make_pair( (int)idMap(i)[0], (int)idMap(i)[1]) ); + } } }; @@ -2093,7 +2071,7 @@ std::vector > SMESH_Swig::getSelectedEdgeOfCell(const char* u init(); - _PTR(SObject) sobject = uid2object( myCachedStudyId, uid ); + _PTR(SObject) sobject = uid2object( uid ); if ( sobject ) pairs = ProcessEvent( new TGetSelectedPairEvent( sobject->GetID().c_str() ) );